Skip to content

Commit

Permalink
fix(#108): Support environment variables in yaks-config.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed May 8, 2020
1 parent 8c656ef commit bc47e6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/jdbc/yaks-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
config:
runtime:
env:
- name: CITRUS_DEFAULT_MESSAGE_TYPE
value: PLAINTEXT
settings:
dependencies:
- groupId: org.postgresql
Expand Down
6 changes: 6 additions & 0 deletions pkg/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type StepConfig struct {
type RuntimeConfig struct {
Cucumber CucumberConfig
Settings SettingsConfig
Env []EnvConfig
}

type CucumberConfig struct {
Expand All @@ -54,6 +55,11 @@ type CucumberConfig struct {
Options string `yaml:"options"`
}

type EnvConfig struct {
Name string `yaml:"name"`
Value string `yaml:"value"`
}

type SettingsConfig struct {
Repositories []RepositoryConfig
Dependencies []DependencyConfig
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ func (o *testCmdOptions) setupEnvSettings(test *v1alpha1.Test, runConfig *config
env = append(env, DependenciesEnv+"="+strings.Join(o.dependencies, ","))
}

for _, envConfig := range runConfig.Config.Runtime.Env {
env = append(env, envConfig.Name+"="+envConfig.Value)
}

if o.env != nil {
copy(env, o.env)
}
Expand Down

0 comments on commit bc47e6c

Please sign in to comment.