Prefer the environment variable to the config file
@@ -18,6 +18,7 @@ package generation
import (
"fmt"
+ "os"
"os/user"
"path/filepath"
"strings"
@@ -242,6 +243,13 @@ func (s *StormForgerSource) stormForgerAccessToken(org string) *optimizeappsv1al
return fixRef(s.Application.StormForger.AccessToken.DeepCopy())
}
+ // If the environment variable is set, take that over the file
+ if tok, ok := os.LookupEnv("STORMFORGER_JWT"); ok {
+ return fixRef(&optimizeappsv1alpha1.StormForgerAccessToken{
+ Literal: tok,
+ })
+ }
+
// Check the config file to see if there is something we can use
if usr, err := user.Current(); err == nil {
if config, err := toml.LoadFile(filepath.Join(usr.HomeDir, ".stormforger.toml")); err == nil {
