package fn import ( "os" "sigs.k8s.io/kustomize/kyaml/fn/framework/command" ) const ( standaloneEnv = "EDGE_KPT_FN_STANDALONE" ) // Standalone reads the environment to determine if this function // should be standalone or not: https://pkg.go.dev/sigs.k8s.io/kustomize/kyaml@v0.10.19/fn/framework/command#Build // // checks for environment variable EDGE_KPT_FN_STANDALONE: // // - if it is present (with any value, or empty value), standalone mode is enabled // // - if it isnt present, standalone mode is disabled func Standalone() command.CLIMode { _, set := os.LookupEnv(standaloneEnv) if set { return command.StandaloneEnabled } return command.StandaloneDisabled } // EnableStandalone allows enabling standalone mode in Edge Kpt functions // programmatically. // // It is a thin wrapper around the internal constant for the standalone mode // environment variable name. func EnableStandalone() { os.Setenv(standaloneEnv, "true") }