feat(config): Add EdgeConnectURL configuration parameter
Some checks failed
Go Tests / go-tests (push) Failing after 2m47s

Makes the EdgeConnect URL configurable through the config.toml file instead of hardcoding it in the provider code. This change:

- Adds new EdgeConnectURL field to Config struct
- Implements validation to ensure URL is provided
- Updates example config.toml with default URL
- Modifies provider to use configured URL value

This improves deployment flexibility by allowing different edge connect endpoints without code changes.
This commit is contained in:
Daniel Sy 2025-10-16 18:03:55 +02:00
parent d1105d1776
commit 8c9f2b37d8
Signed by: Daniel.Sy
GPG key ID: 1F39A8BBCD2EE3D3
3 changed files with 7 additions and 1 deletions

View file

@ -48,6 +48,7 @@ type Config struct {
Organization string `toml:"organization"` Organization string `toml:"organization"`
CloudletKey CloudletKey `toml:"cloudlet"` CloudletKey CloudletKey `toml:"cloudlet"`
Region string `toml:"region"` Region string `toml:"region"`
EdgeConnectURL string `toml:"edge_connect_url"`
} }
type Credentials struct { type Credentials struct {
@ -65,5 +66,9 @@ func (c *Config) Validate() error {
return fmt.Errorf("log_file is not defined in provider config") return fmt.Errorf("log_file is not defined in provider config")
} }
if c.EdgeConnectURL == "" {
return fmt.Errorf("edge_connect_url is not defined in provider config")
}
return nil return nil
} }

View file

@ -1,3 +1,4 @@
edge_connect_url = "https://hub.apps.orca.platform.mg3.mdb.osc.live"
organization = "edp-developer-framework" organization = "edp-developer-framework"
region = "EU" region = "EU"
log_file = "./lala.log" log_file = "./lala.log"

View file

@ -59,7 +59,7 @@ func NewEdgeConnectProvider(configPath, controllerID string) (execution.External
} }
client := edgeconnect.NewClientWithCredentials( client := edgeconnect.NewClientWithCredentials(
"https://hub.apps.edge.platform.mg3.mdb.osc.live", conf.EdgeConnectURL,
creds.Username, creds.Username,
creds.Password, creds.Password,
edgeconnect.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}), edgeconnect.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}),