mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-07-20 07:02:53 +02:00
initial import
This commit is contained in:
28
configuration/application-configuration/cmd/main.go
Normal file
28
configuration/application-configuration/cmd/main.go
Normal file
@ -0,0 +1,28 @@
|
||||
/*Package main show how to use envconfig.
|
||||
|
||||
Start the app in the root folder with:
|
||||
|
||||
SERVER_PORT=8080 SERVER_HOST=localhost go run cmd/main.go
|
||||
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
"golang.source-fellows.com/samples/applicationconfiguration"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
cfg := applicationconfiguration.Config{}
|
||||
err := envconfig.Process("", &cfg)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(cfg.Server.Port)
|
||||
|
||||
}
|
Reference in New Issue
Block a user