Last active
April 12, 2020 11:51
-
-
Save presmihaylov/6b47c8664cfbbe3be1a653d81d1bcd07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package configfx | |
// imports | |
// ApplicationConfig ... | |
type ApplicationConfig struct { | |
Address string `yaml:"address"` | |
} | |
// Config ... | |
type Config struct { | |
ApplicationConfig `yaml:"application"` | |
} | |
// ProvideConfig to fx | |
func ProvideConfig() *Config { | |
conf := Config{} | |
data, err := ioutil.ReadFile("config/base.yaml") | |
// handle error | |
err = yaml.Unmarshal([]byte(data), &conf) | |
// handle error | |
return &conf | |
} | |
// example continues |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment