diff --git a/core/config/env/env.go b/core/config/env/env.go index 0d5359f2d51..dd83d8a2e39 100644 --- a/core/config/env/env.go +++ b/core/config/env/env.go @@ -8,12 +8,12 @@ import ( ) var ( - Config = Env("CL_CONFIG") + Config = Var("CL_CONFIG") // LOOPP commands and vars - MedianPluginCmd = Env("CL_MEDIAN_CMD") - SolanaPluginCmd = Env("CL_SOLANA_CMD") - StarknetPluginCmd = Env("CL_STARKNET_CMD") + MedianPluginCmd = Var("CL_MEDIAN_CMD") + SolanaPluginCmd = Var("CL_SOLANA_CMD") + StarknetPluginCmd = Var("CL_STARKNET_CMD") // PrometheusDiscoveryHostName is the externally accessible hostname // published by the node in the `/discovery` endpoint. Generally, it is expected to match // the public hostname of node. @@ -21,32 +21,32 @@ var ( // that Prometheus can discovery LOOPps. // In house we observed that the resolved value of os.Hostname was not accessible to // outside of the given pod - PrometheusDiscoveryHostName = Env("CL_PROMETHEUS_DISCOVERY_HOSTNAME") + PrometheusDiscoveryHostName = Var("CL_PROMETHEUS_DISCOVERY_HOSTNAME") // EnvLooopHostName is the hostname used for HTTP communication between the // node and LOOPps. In most cases this does not need to be set explicitly. - LooppHostName = Env("CL_LOOPP_HOSTNAME") - - DatabaseAllowSimplePasswords = Env("CL_DATABASE_ALLOW_SIMPLE_PASSWORDS") - DatabaseURL = EnvSecret("CL_DATABASE_URL") - DatabaseBackupURL = EnvSecret("CL_DATABASE_BACKUP_URL") - ExplorerAccessKey = EnvSecret("CL_EXPLORER_ACCESS_KEY") - ExplorerSecret = EnvSecret("CL_EXPLORER_SECRET") - PasswordKeystore = EnvSecret("CL_PASSWORD_KEYSTORE") - PasswordVRF = EnvSecret("CL_PASSWORD_VRF") - PyroscopeAuthToken = EnvSecret("CL_PYROSCOPE_AUTH_TOKEN") - PrometheusAuthToken = EnvSecret("CL_PROMETHEUS_AUTH_TOKEN") - ThresholdKeyShare = EnvSecret("CL_THRESHOLD_KEY_SHARE") + LooppHostName = Var("CL_LOOPP_HOSTNAME") + + DatabaseAllowSimplePasswords = Var("CL_DATABASE_ALLOW_SIMPLE_PASSWORDS") + DatabaseURL = Secret("CL_DATABASE_URL") + DatabaseBackupURL = Secret("CL_DATABASE_BACKUP_URL") + ExplorerAccessKey = Secret("CL_EXPLORER_ACCESS_KEY") + ExplorerSecret = Secret("CL_EXPLORER_SECRET") + PasswordKeystore = Secret("CL_PASSWORD_KEYSTORE") + PasswordVRF = Secret("CL_PASSWORD_VRF") + PyroscopeAuthToken = Secret("CL_PYROSCOPE_AUTH_TOKEN") + PrometheusAuthToken = Secret("CL_PROMETHEUS_AUTH_TOKEN") + ThresholdKeyShare = Secret("CL_THRESHOLD_KEY_SHARE") ) -type Env string +type Var string -func (e Env) Get() string { return os.Getenv(string(e)) } +func (e Var) Get() string { return os.Getenv(string(e)) } // Lookup wraps [os.LookupEnv] -func (e Env) Lookup() (string, bool) { return os.LookupEnv(string(e)) } +func (e Var) Lookup() (string, bool) { return os.LookupEnv(string(e)) } -func (e Env) IsTrue() bool { return strings.ToLower(e.Get()) == "true" } +func (e Var) IsTrue() bool { return strings.ToLower(e.Get()) == "true" } -type EnvSecret string +type Secret string -func (e EnvSecret) Get() models.Secret { return models.Secret(os.Getenv(string(e))) } +func (e Secret) Get() models.Secret { return models.Secret(os.Getenv(string(e))) }