Skip to content

Commit bdd4f05

Browse files
Air gapped subscription changes
1 parent d39c68b commit bdd4f05

File tree

2 files changed

+65
-7
lines changed

2 files changed

+65
-7
lines changed

db-connector.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13533,10 +13533,10 @@ func GetEsConfig(defaultCreds bool) *opensearch.Client {
1353313533
return es
1353413534
}
1353513535

13536-
func checkNoInternet() bool {
13536+
func checkNoInternet() (bool, string) {
1353713537
licenseKey := os.Getenv("SHUFFLE_LICENSE")
1353813538
if len(licenseKey) == 0 {
13539-
return false
13539+
return false, ""
1354013540
}
1354113541

1354213542
// Month + Year -> when it runs out
@@ -13556,16 +13556,16 @@ func checkNoInternet() bool {
1355613556
log.Printf("[DEBUG] License key is valid")
1355713557
}
1355813558

13559-
return true
13559+
return true, timeout
1356013560
} else {
1356113561
log.Printf("[ERROR] License key has expired on %s", timeout)
13562-
return false
13562+
return false, timeout
1356313563
}
1356413564
}
1356513565
}
1356613566

1356713567
log.Printf("[ERROR] No valid license key found based SHUFFLE_LICENSE %s", licenseKey)
13568-
return false
13568+
return false, ""
1356913569
}
1357013570

1357113571
func UploadAppSpecFiles(ctx context.Context, client *storage.Client, api WorkflowApp, parsed ParsedOpenApi) (WorkflowApp, error) {

shared.go

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11784,7 +11784,7 @@ func HandleCreateSubOrg(resp http.ResponseWriter, request *http.Request) {
1178411784
parentOrg.SyncUsage.MultiTenant.Counter = int64(len(childOrgs))
1178511785
}
1178611786

11787-
isLicensed := checkNoInternet()
11787+
isLicensed, _ := checkNoInternet()
1178811788
if !parentOrg.CloudSync && !isLicensed && len(childOrgs) >= 3 {
1178911789
log.Printf("[WARNING] Organization %s has exceeded the free plan limit of 3 sub-organizations. An enterprise license is required to create additional sub-organizations.", parentOrg.Id)
1179011790
resp.WriteHeader(400)
@@ -30843,7 +30843,7 @@ func HandleCheckLicense(ctx context.Context, org Org) Org {
3084330843

3084430844
} else if len(shuffleLicenseKey) > 0 {
3084530845

30846-
license := checkNoInternet()
30846+
license, timeout := checkNoInternet()
3084730847
if license == true {
3084830848
org.SyncFeatures.MultiEnv.Limit = 100
3084930849
org.SyncFeatures.MultiEnv.Active = true
@@ -30870,6 +30870,64 @@ func HandleCheckLicense(ctx context.Context, org Org) Org {
3087030870
org.SyncFeatures.ShuffleGPT.Active = true
3087130871
}
3087230872

30873+
parsedEula := GetOnpremPaidEula()
30874+
30875+
log.Printf("[DEBUG] Org has the Enterprise License Key")
30876+
30877+
var endDate int64
30878+
var cancellationDate int64
30879+
active := false
30880+
30881+
features := []string{
30882+
"∞ Days Workflow Run History",
30883+
"∞ Days Workflow Backup",
30884+
"∞ Users",
30885+
"Air Gap Environment",
30886+
"Critical Response",
30887+
"On-Call Support",
30888+
"Setup and Maintenance",
30889+
"Key Management System",
30890+
"Custom Integrations",
30891+
"Custom Scaling Options",
30892+
"Billing and Invoice Included",
30893+
"Custom Contract",
30894+
}
30895+
30896+
if license {
30897+
parsedTimeout, err := time.Parse("02-01-2006", timeout)
30898+
if err != nil {
30899+
log.Printf("[ERROR] Failed parsing license timeout: %s", err)
30900+
parsedTimeout = time.Now()
30901+
}
30902+
endDate = parsedTimeout.Unix()
30903+
cancellationDate = 0
30904+
active = true
30905+
} else {
30906+
endDate = time.Now().Unix()
30907+
cancellationDate = time.Now().Unix()
30908+
active = false
30909+
}
30910+
30911+
subscription := PaymentSubscription{
30912+
Name: "Enterprise License",
30913+
Active: active,
30914+
CancellationDate: cancellationDate,
30915+
SupportLevel: "Enterprise Support",
30916+
Startdate: time.Now().Unix(),
30917+
Enddate: endDate,
30918+
Recurrence: string("monthly"),
30919+
Amount: "0",
30920+
Currency: string("USD"),
30921+
Level: "1",
30922+
Reference: "",
30923+
Limit: 1,
30924+
Features: features,
30925+
EulaSigned: true,
30926+
Eula: parsedEula,
30927+
}
30928+
30929+
org.Subscriptions = []PaymentSubscription{subscription}
30930+
3087330931
} else {
3087430932
log.Printf("[WARNING] Org %v does not have an enterprise license. Please purchase an enterprise license to unlock production-ready features. Contact support@shuffler.io for more information.", org.Id)
3087530933
org.SyncFeatures.MultiEnv.Limit = 1

0 commit comments

Comments
 (0)