MartinHeinz / go-project-blueprint

Blueprint/Boilerplate For Golang Projects
MIT License
489 stars 111 forks source link

viper usage #5

Open bdarge opened 3 years ago

bdarge commented 3 years ago

I like your blueprint. I know the purpose of the blueprint is not about config but I think there is an issue in your viper usage. Without changing anything I created an image make container OS=linux, then I tried to create a docker container but I run to the following error.

panic: interface conversion: interface {} is nil, not string

goroutine 1 [running]:
github.com/bdarge/go-project-blueprint/cmd/blueprint/config.LoadConfig(0xc000161110, 0x1, 0x1, 0xcbc689, 0x2)
    /src/cmd/blueprint/config/config.go:37 +0x59f
main.main()
    /src/cmd/blueprint/main.go:39 +0x85

I guess one can do Config.DSN = v.Get("DSN").(string) only after config has read. I may be wrong.