Use configuration input struct (#645)

As we will be passing more flags to configure
 local agents, we need a more flexible type
This commit is contained in:
Maycon Santos
2023-01-08 12:57:28 +01:00
committed by GitHub
parent 27f4993ce3
commit ca62f6787a
7 changed files with 91 additions and 41 deletions

View File

@@ -20,7 +20,12 @@ func TestGetConfig(t *testing.T) {
preSharedKey := "preSharedKey"
// case 1: new config has to be generated
config, err := GetConfig(managementURL, adminURL, path, preSharedKey)
config, err := GetConfig(ConfigInput{
ManagementURL: managementURL,
AdminURL: adminURL,
ConfigPath: path,
PreSharedKey: &preSharedKey,
})
if err != nil {
return
}
@@ -33,7 +38,12 @@ func TestGetConfig(t *testing.T) {
}
// case 2: existing config -> fetch it
config, err = GetConfig(managementURL, adminURL, path, preSharedKey)
config, err = GetConfig(ConfigInput{
ManagementURL: managementURL,
AdminURL: adminURL,
ConfigPath: path,
PreSharedKey: &preSharedKey,
})
if err != nil {
return
}
@@ -43,7 +53,12 @@ func TestGetConfig(t *testing.T) {
// case 3: existing config, but new managementURL has been provided -> update config
newManagementURL := "https://test.newManagement.url:33071"
config, err = GetConfig(newManagementURL, adminURL, path, preSharedKey)
config, err = GetConfig(ConfigInput{
ManagementURL: newManagementURL,
AdminURL: adminURL,
ConfigPath: path,
PreSharedKey: &preSharedKey,
})
if err != nil {
return
}