Added initial hybrid proxy setup
This commit is contained in:
@@ -727,7 +727,7 @@ class AppBase:
|
||||
parsedvalue = json.loads(allvalues["value"])
|
||||
allvalues["value"] = parsedvalue
|
||||
except:
|
||||
print("Parsing of value as JSON failed")
|
||||
print("Parsing of value as JSON failed. Continue anyway!")
|
||||
|
||||
return allvalues
|
||||
except:
|
||||
@@ -1377,7 +1377,10 @@ class AppBase:
|
||||
cachedata = self.get_cache(actual_key)
|
||||
print("CACHE: %s" % cachedata)
|
||||
parsersplit.pop(1)
|
||||
baseresult = cachedata
|
||||
try:
|
||||
baseresult = json.dumps(cachedata)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
print("Failed json dumping: %s" % e)
|
||||
|
||||
#returndata = str(baseresult)+str(appendresult)
|
||||
else:
|
||||
|
||||
+26
-3
@@ -2106,7 +2106,11 @@ func executeCloudAction(action shuffle.CloudSyncJob, apikey string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
client := &http.Client{}
|
||||
transport := http.DefaultTransport.(*http.Transport).Clone()
|
||||
client := &http.Client{
|
||||
Transport: transport,
|
||||
}
|
||||
|
||||
syncUrl := fmt.Sprintf("%s/api/v1/cloud/sync/handle_action", syncUrl)
|
||||
req, err := http.NewRequest(
|
||||
"POST",
|
||||
@@ -3828,6 +3832,22 @@ func remoteOrgJobHandler(org shuffle.Org, interval int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func runInitCloudSetup() {
|
||||
action := shuffle.CloudSyncJob{
|
||||
Type: "setup",
|
||||
Action: "init",
|
||||
OrgId: "",
|
||||
PrimaryItemId: "",
|
||||
}
|
||||
|
||||
err := executeCloudAction(action, "")
|
||||
if err != nil {
|
||||
log.Printf("[INFO] Failed initial setup: %s", err)
|
||||
} else {
|
||||
log.Printf("[INFO] Ran initial setup!")
|
||||
}
|
||||
}
|
||||
|
||||
func runInitEs(ctx context.Context) {
|
||||
log.Printf("[DEBUG] Starting INIT setup (ES)")
|
||||
|
||||
@@ -3842,7 +3862,8 @@ func runInitEs(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Error getting organizations: %s", err)
|
||||
log.Printf("[DEBUG] Error getting organizations: %s", err)
|
||||
runInitCloudSetup()
|
||||
} else {
|
||||
// Add all users to it
|
||||
if len(activeOrgs) == 1 {
|
||||
@@ -3850,7 +3871,9 @@ func runInitEs(ctx context.Context) {
|
||||
}
|
||||
|
||||
if len(activeOrgs) == 0 {
|
||||
log.Printf(`No orgs. Setting NEW org "default"`)
|
||||
log.Printf(`[DEBUG] No orgs. Setting NEW org "default"`)
|
||||
runInitCloudSetup()
|
||||
|
||||
//orgSetupName := "default"
|
||||
//orgId := uuid.NewV4().String()
|
||||
//newOrg := shuffle.Org{
|
||||
|
||||
Reference in New Issue
Block a user