diff --git a/cmd/proxy/config/config.yml b/cmd/proxy/config/config.yml index dbf15b7..a3f964d 100644 --- a/cmd/proxy/config/config.yml +++ b/cmd/proxy/config/config.yml @@ -9,4 +9,10 @@ rules: - name: "request payload must contain at least one character and should contain at least one header" predicate: "p => LEN(p.payload) > 0 && LEN(p.headers) > 0" - name: "payload must be a json" - predicate: "p => FORMAT(p.payload) == 'json'" \ No newline at end of file + predicate: "p => FORMAT(p.payload) == 'json'" + +# For now it will be here but it should be moved to env variables +database: + # Its docker compose based connection string + connectionString: "dns:root@tcp(127.0.0.1:3306)/dns" + diff --git a/internal/config/yaml.go b/internal/config/yaml.go index 2aeb72d..f255c44 100644 --- a/internal/config/yaml.go +++ b/internal/config/yaml.go @@ -7,8 +7,9 @@ import ( ) type YamlConfig struct { - DNS []*Dns `yaml:"dns"` - Rules Rules `yaml:"rules"` + DNS []*Dns `yaml:"dns"` + Rules Rules `yaml:"rules"` + Database Database `yaml:"database"` } type Dns struct { @@ -27,6 +28,12 @@ type CustomRule struct { Predicate string `yaml:"predicate"` } +// Database represents database config. +// Its temp as it should be moved to environment variables +type Database struct { + ConnectionString string `yaml:"connectionString"` +} + func NewYamlConfig(yamlBytes []byte) (*YamlConfig, error) { var yamlCfg YamlConfig if err := yaml.Unmarshal(yamlBytes, &yamlCfg); err != nil {