23 lines
360 B
Go
23 lines
360 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"go.uber.org/config"
|
|
)
|
|
|
|
func New() (config.Provider, error) {
|
|
configFileName := os.Getenv("CONFIG_FILE")
|
|
if configFileName == "" {
|
|
configFileName = "config.yml"
|
|
}
|
|
provider, err := config.NewYAML(
|
|
config.File("config.yml"),
|
|
config.Expand(os.LookupEnv),
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return provider, nil
|
|
}
|