Secrets/Config
Configuration
Configuration values are named, typed values. They are managed by the ftl config
command-line.
To declare a configuration value use the following syntax:
var defaultUser = ftl.Config[Username]("defaultUser")
Then to retrieve a configuration value:
username = defaultUser.Get(ctx)
Secrets
Secrets are encrypted, named, typed values. They are managed by the ftl secret
command-line.
Declare a secret with the following:
var apiKey = ftl.Secret[Credentials]("apiKey")
Then to retrieve a secret value:
key = apiKey.Get(ctx)
Transforming secrets/configuration
Often, raw secret/configuration values aren't directly useful. For example, raw credentials might be used to create an API client. For those situations ftl.Map()
can be used to transform a configuration or secret value into another type:
var client = ftl.Map(ftl.Secret[Credentials]("credentials"),
func(ctx context.Context, creds Credentials) (*api.Client, error) {
return api.NewClient(creds)
})