Skip to content
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

FIX: config population fail #1393

Merged
merged 14 commits into from
Mar 29, 2024
34 changes: 19 additions & 15 deletions handlers/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,14 @@ func populateConfigFromAccount(account models.Account, config *models.Config) er
switch account.Provider {
case "aws":
awsConfig := models.AWSConfig{
Name: account.Name,
Profile: account.Credentials["profile"],
Path: account.Credentials["path"],
Source: account.Credentials["source"],
Name: account.Name,
Source: account.Credentials["source"],
}
if account.Credentials["source"] == "credentials-file" {
awsConfig.Profile = account.Credentials["profile"]
if path, ok := account.Credentials["path"]; ok && len(path) > 0 {
awsConfig.Path = account.Credentials["path"]
}
}
config.AWS = append(config.AWS, awsConfig)

Expand Down Expand Up @@ -443,38 +447,38 @@ func populateConfigFromAccount(account models.Account, config *models.Config) er

case "mongodb":
mongoDBAtlasConfig := models.MongoDBAtlasConfig{
Name: account.Name,
PublicApiKey: account.Credentials["publicKey"],
PrivateApiKey: account.Credentials["privateKey"],
Name: account.Name,
PublicApiKey: account.Credentials["publicKey"],
PrivateApiKey: account.Credentials["privateKey"],
OrganizationID: account.Credentials["organizationId"],
}
config.MongoDBAtlas = append(config.MongoDBAtlas, mongoDBAtlasConfig)

case "gcp":
gcpConfig := models.GCPConfig{
Name: account.Name,
Name: account.Name,
ServiceAccountKeyPath: account.Credentials["accountKey"],
}
config.GCP = append(config.GCP, gcpConfig)

case "ovh":
ovhConfig := models.OVHConfig{
Name: account.Name,
Endpoint: account.Credentials["endpoint"],
ApplicationKey: account.Credentials["applicationKey"],
Name: account.Name,
Endpoint: account.Credentials["endpoint"],
ApplicationKey: account.Credentials["applicationKey"],
ApplicationSecret: account.Credentials["applicationSecret"],
ConsumerKey: account.Credentials["consumerKey"],
ConsumerKey: account.Credentials["consumerKey"],
}
config.OVH = append(config.OVH, ovhConfig)

default:
return fmt.Errorf("Illegle provider")
return fmt.Errorf("illegle provider")
}

return nil
}

func updateConfig(path string, cfg *models.Config) error {
func updateConfig(path string, cfg *models.Config) error {
mu.Lock()
defer mu.Unlock()

Expand All @@ -491,4 +495,4 @@ func updateConfig(path string, cfg *models.Config) error {
return err
}
return nil
}
}
Loading