Skip to content

Commit

Permalink
fix: same as last commit but for secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Apr 26, 2024
1 parent cf5223c commit 3061270
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions common/configuration/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ type Manager[R Role] struct {
resolver Resolver[R]
}

func configFromEnvironment() []string {
if envar, ok := os.LookupEnv("FTL_CONFIG"); ok {
return strings.Split(envar, ",")
}
return nil
}

// NewDefaultSecretsManagerFromEnvironment creates a new secrets manager from
// the default ftl-project.toml.
func NewDefaultSecretsManagerFromEnvironment(ctx context.Context) (*Manager[Secrets], error) {
var cr Resolver[Secrets] = ProjectConfigResolver[Secrets]{}
var cr Resolver[Secrets] = ProjectConfigResolver[Secrets]{Config: configFromEnvironment()}
return (DefaultSecretsMixin{}).NewSecretsManager(ctx, cr)
}

// NewDefaultConfigurationManagerFromEnvironment creates a new configuration
// manager from the default ftl-project.toml.
func NewDefaultConfigurationManagerFromEnvironment(ctx context.Context) (*Manager[Configuration], error) {
var configs []string
if envar, ok := os.LookupEnv("FTL_CONFIG"); ok {
configs = strings.Split(envar, ",")
}
cr := ProjectConfigResolver[Configuration]{Config: configs}
cr := ProjectConfigResolver[Configuration]{Config: configFromEnvironment()}
return (DefaultConfigMixin{}).NewConfigurationManager(ctx, cr)
}

Expand Down

0 comments on commit 3061270

Please sign in to comment.