Allow the audience to be overwritten via envvar
This is necessary to allow testing during the migration to new audience values
@@ -61,10 +61,16 @@ func NewRootCommand() *cobra.Command {
cfg := &config.OptimizeConfig{}
commander.ConfigGlobals(cfg, rootCmd)
+ // TODO This is temporary while we migrate the audience value
+ aud := os.Getenv("STORMFORGE_AUDIENCE")
+ if aud == "" {
+ aud = "https://api.carbonrelay.io/v1/"
+ }
+
// Establish OAuth client identity
cfg.ClientIdentity = authorizationIdentity
cfg.AuthorizationParameters = map[string][]string{
- "audience": {"https://api.carbonrelay.io/v1/"},
+ "audience": {aud},
}
// Kubernetes Commands
