Skip to content

Commit

Permalink
Expand environment variables for components (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored Feb 6, 2025
1 parent 378b788 commit d08d744
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/custom-resource/components/loader/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import (
"bytes"
"context"
"fmt"
"github.com/google/uuid"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
"io"
"io/ioutil"
"k8s.io/klog/v2"
"os"
"path/filepath"
"rusi/pkg/custom-resource/components"
"strings"

"github.com/google/uuid"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
"k8s.io/klog/v2"
)

const (
Expand Down Expand Up @@ -85,6 +87,9 @@ func loadComponentsFromFile(path string) ([]components.Spec, error) {
klog.Errorf("load components error when reading file %s : %s", path, err)
return comps, err
}

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

comps, errs = decodeYaml(b)
for _, err := range errs {
errStr := fmt.Sprintf("load components error when parsing components yaml resource in %s : %s", path, err)
Expand Down

0 comments on commit d08d744

Please sign in to comment.