Skip to content

Commit

Permalink
Support expanding cluster and topic yaml config files with the system…
Browse files Browse the repository at this point in the history
… environment variables (#46)

There is currently no support for reading environment variables and change the config file accordingly before applying the config. This PR expands the content read from both cluster and topic config files prior to parsing them.
  • Loading branch information
mortezaalizadeh authored Oct 14, 2021
1 parent c689f3a commit 68d6f6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"errors"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
Expand All @@ -20,6 +21,8 @@ func LoadClusterFile(path string) (ClusterConfig, error) {
return ClusterConfig{}, err
}

contents = []byte(os.ExpandEnv(string(contents)))

absPath, err := filepath.Abs(path)
if err != nil {
return ClusterConfig{}, err
Expand Down Expand Up @@ -48,6 +51,8 @@ func LoadTopicsFile(path string) ([]TopicConfig, error) {
return nil, err
}

contents = []byte(os.ExpandEnv(string(contents)))

trimmedFile := strings.TrimSpace(string(contents))
topicStrs := sep.Split(trimmedFile, -1)

Expand Down

0 comments on commit 68d6f6e

Please sign in to comment.