From 30612700dba92dbb3a6bb63c1b3ca880085f6849 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Fri, 26 Apr 2024 19:01:39 +1000 Subject: [PATCH] fix: same as last commit but for secrets --- common/configuration/manager.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/configuration/manager.go b/common/configuration/manager.go index 41b1f2c9ce..8cdfe54f39 100644 --- a/common/configuration/manager.go +++ b/common/configuration/manager.go @@ -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) }