Skip to content
Snippets Groups Projects
Unverified Commit 3f86f9a8 authored by Jonas Theis's avatar Jonas Theis Committed by GitHub
Browse files

Enable configuration via ENV variables (#481)

parent 53c315e5
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"strings"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/node"
......@@ -56,6 +57,12 @@ func init() {
// It automatically reads in a single config file starting with "config" (can be changed via the --config CLI flag)
// and ending with: .json, .toml, .yaml or .yml (in this sequence).
func fetch(printConfig bool, ignoreSettingsAtPrint ...[]string) error {
// replace dots with underscores in env
dotReplacer := strings.NewReplacer(".", "_")
Node.SetEnvKeyReplacer(dotReplacer)
// read in ENV variables
Node.AutomaticEnv()
flag.Parse()
err := parameter.LoadConfigFile(Node, *configDirPath, *configName, true, *skipConfigAvailable)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment