-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Improvement over health API #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8b95450
249ebce
8fd4bc5
22b9936
97ba50f
8c7b74f
a195df0
583754a
b44195c
a9d13e1
18aeafe
68b865f
2e32732
b0d0376
78ae550
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -885,10 +885,7 @@ func fixOpensearch() error { | |
| return nil | ||
| } | ||
|
|
||
| func fixSubflow(ctx context.Context, workflow *Workflow) error { | ||
|
|
||
| apiKey := os.Getenv("SHUFFLE_OPS_DASHBOARD_APIKEY") | ||
| orgId := os.Getenv("SHUFFLE_OPS_DASHBOARD_ORG") | ||
| func fixSubflowParameters(ctx context.Context, workflow *Workflow, apiKey string, orgId string) error { | ||
|
|
||
| subflowActionId := "" | ||
| for _, action := range workflow.Actions { | ||
|
|
@@ -910,12 +907,20 @@ func fixSubflow(ctx context.Context, workflow *Workflow) error { | |
| } | ||
| } | ||
|
|
||
| baseUrl := os.Getenv("SHUFFLE_CLOUDRUN_URL") | ||
| if len(baseUrl) == 0 { | ||
| baseUrl := "https://shuffler.io" | ||
| if len(os.Getenv("SHUFFLE_CLOUDRUN_URL")) > 0 { | ||
|
||
| log.Printf("[DEBUG] Base url not set. Setting to default") | ||
| baseUrl = "https://shuffler.io" | ||
| baseUrl = os.Getenv("SHUFFLE_CLOUDRUN_URL") | ||
| } | ||
|
|
||
| if project.Environment == "onprem" { | ||
| log.Printf("[DEBUG] Onprem environment. Setting base url to localhost") | ||
| // This will work as the health will be handled in the backend itself. | ||
| // so localhost just works. (Tested) | ||
| baseUrl = "http://localhost:5001" | ||
yashsinghcodes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
|
|
||
| req, err := http.NewRequest("PUT", baseUrl+"/api/v1/workflows/"+workflow.ID+"?skip_save=true", nil) | ||
|
||
| if err != nil { | ||
| log.Println("[ERROR] creating HTTP request:", err) | ||
|
|
@@ -1028,7 +1033,7 @@ func RunOpsWorkflow(apiKey string, orgId string, cloudRunUrl string) (WorkflowHe | |
| workflowHealth.WorkflowId = opsWorkflowID | ||
| updateOpsCache(workflowHealth) | ||
|
|
||
| err = fixSubflow(ctx, workflowPtr) | ||
| err = fixSubflowParameters(ctx, workflowPtr, apiKey, orgId) | ||
|
|
||
| workflow := *workflowPtr | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a generic function we can pass in a workflow into and it will fix parameters at all times, or is it specifically for health?
If it's for health, please make that clear in the name, as while grepping for relevant functions, I may end up just using it (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is specifically for the health API. Let me fix the name of the functions to make them more clear :)