You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invalid input here causes panic. Set an invalid environment variable (TB_CHAINS_MAINNETRPC
for example -- it should be TB_CHAINS_MAINNET_RPCPROVIDER) and run the tests to see the panic.
// loadFromEnv loads configuration from environment variables
func loadFromEnv(prefix string, destination *ConfigFile) (err error) {
// First we get all env variables then filter by prefix and finally parse the values
envs := os.Environ()
for i := 0; i < len(envs); i++ {
// Turn VAR=value into []string{"VAR", "value"}
parsed := strings.Split(envs[i], "=")
if !strings.HasPrefix(parsed[0], prefix) {
continue
}
// Turn PARENT_CHILD into []string{"PARENT", "CHILD"}
path := strings.Split(parsed[0][len(prefix):], "_")
if err := setByPath(destination, path, parsed[1]); err != nil {
return err
}
}
return nil
}
The text was updated successfully, but these errors were encountered:
The following code fails with invalid input:
Invalid input here causes panic. Set an invalid environment variable (TB_CHAINS_MAINNETRPC
for example -- it should be TB_CHAINS_MAINNET_RPCPROVIDER) and run the tests to see the panic.
The text was updated successfully, but these errors were encountered: