Skip to content

Commit

Permalink
fix: make LOADER_YAML_PATH as secondary load after default yaml loa…
Browse files Browse the repository at this point in the history
…ded first
  • Loading branch information
isdzulqor committed Aug 28, 2024
1 parent 8c91c63 commit a4e247e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions cmd/server/startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,28 @@ func (s *Startup) serve(ctx context.Context, h http.Handler) error {
}

func (s *Startup) loadYAML(ctx context.Context, team model.TeamModel) error {
if s.Config.LoaderYAMLPath != "" {
yamlPathFile := stringLib.SanitizePath(s.Config.BasePath + s.Config.LoaderYAMLPath)
yamlData, err := ioutil.ReadFile(yamlPathFile)
yamlPathFile := stringLib.SanitizePath(s.Config.BasePath + "/migration/yaml/loader.yaml")
yamlData, err := ioutil.ReadFile(yamlPathFile)
if err != nil {
return fmt.Errorf("Failed to read yaml file: %v", err)
}
err = s.YamlService.Load(ctx, yamlData, team)
if err != nil {
return fmt.Errorf("Failed to load yaml from file: %v", err)
}

if len(s.Config.LoaderYAMLPath) > 0 {
yamlData, err = ioutil.ReadFile(s.Config.LoaderYAMLPath)
if err != nil {
return fmt.Errorf("Failed to read yaml file: %v", err)
}
err = s.YamlService.Load(ctx, yamlData, team)
if err != nil {
return fmt.Errorf("Failed to load yaml from file: %v", err)
}
} else if len(s.Config.Loader) > 0 {
}

if len(s.Config.Loader) > 0 {
decoded, err := base64.StdEncoding.DecodeString(s.Config.Loader)
if err != nil {
return fmt.Errorf("Failed to decode loader: %v", err)
Expand Down

0 comments on commit a4e247e

Please sign in to comment.