# README
Omnistrate Licensing SDK for Go
Overview
omnistrate-licensing-sdk-go is an SDK that allow to validate license files generated by Omnistrate.
Installation
To install the necessary dependencies, run:
go get -u github.com/omnistrate-oss/omnistrate-licensing-sdk-go
Usage Examples
Pre requisites
The Licensing
feature needs to be enabled for the service plan. When enabling the feature a product identifier can be optionally configured. That value can then be optionally used to Validate the license.
Docker compose example:
x-customer-integrations:
licensing:
# optional - defaults to 7 days
licenseExpirationInDays: 7
# optional - identifier (shared secret) that can be used to add extra security on validation - defaults to product tier id
productPlanUniqueIdentifier: '[product plan unique id]'
When used on a Container based resource, Omnistrate takes care of mounting the secret and setting the environment variables for verification.
Service spec configuration:
features:
CUSTOMER:
licensing:
# optional - defaults to 7 days
licenseExpirationInDays: 7
# optional - identifier (shared secret) that can be used to add extra security on validation - defaults to product tier id
productPlanUniqueIdentifier: '[product plan unique id]'
When using Helm or Operator the secret service-plan-subscription-license
generated with the license needs to be mounted on /var/subscription/
Get your Organization ID
The Organization ID will be needed to ensure the license maps to products plans defined for your organization. We will that globally unique id in the validation process.
You can get you Organization ID from your user profile.
Usage
During startup and periodically, implement the following check:
Validate License
package main
import (
"fmt"
"github.com/omnistrate-oss/omnistrate-licensing-sdk-go/pkg/validator"
)
func main() {
err := validator.ValidateLicense("[org-id]", "[product plan unique id]") // value should be hardcoded, based on the value configured when enabling the feature
if err != nil {
fmt.Println("License validation for product failed:", err)
} else {
fmt.Println("License validation for product succeeded")
}
}
Contributing
Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING page
About Omnistrate
Omnistrate is the operating system for your SaaS, offering enterprise-grade capabilities: automated provisioning, serverless capabilities, auto-scaling, billing, monitoring, centralized logging, self-healing, intelligent patching and much more!