@@ -41,6 +41,7 @@ For the following examples, we will be considering those configuration files:
41
41
``` yaml title="configs/config.yaml"
42
42
app :
43
43
name : app
44
+ description : app description
44
45
env : dev
45
46
version : 0.1.0
46
47
debug : false
@@ -93,10 +94,11 @@ func NewExampleService(config *config.Config) *ExampleService {
93
94
94
95
func (s *ExampleService) PrintConfig() {
95
96
// helpers
96
- fmt.Printf("name: %s", s.config.AppName()) // name: app
97
- fmt.Printf("env: %s", s.config.AppEnv()) // env: dev
98
- fmt.Printf("version: %s", s.config.AppVersion()) // version: 0.1.0
99
- fmt.Printf("debug: %v", s.config.AppDebug()) // debug: false
97
+ fmt.Printf("name: %s", s.config.AppName()) // name: app
98
+ fmt.Printf("description: %s", s.config.AppDescription()) // description: app description
99
+ fmt.Printf("env: %s", s.config.AppEnv()) // env: dev
100
+ fmt.Printf("version: %s", s.config.AppVersion()) // version: 0.1.0
101
+ fmt.Printf("debug: %v", s.config.AppDebug()) // debug: false
100
102
101
103
// others
102
104
fmt.Printf("string_value: %s", s.config.GetString("config.values.string_value")) // string_value: default
@@ -118,10 +120,11 @@ If you run your application in `test` mode:
118
120
// helpers
119
121
fmt.Printf("var: %s", s.config.GetEnvVar("APP_ENV")) // var: test
120
122
121
- fmt.Printf("name: %s", s.config.AppName()) // name: app
122
- fmt.Printf("env: %s", s.config.AppEnv()) // env: test
123
- fmt.Printf("version: %s", s.config.AppVersion()) // version: 0.1.0
124
- fmt.Printf("debug: %v", s.config.AppDebug()) // debug: true
123
+ fmt.Printf("name: %s", s.config.AppName()) // name: app
124
+ fmt.Printf("description: %s", s.config.AppDescription()) // description: app description
125
+ fmt.Printf("env: %s", s.config.AppEnv()) // env: test
126
+ fmt.Printf("version: %s", s.config.AppVersion()) // version: 0.1.0
127
+ fmt.Printf("debug: %v", s.config.AppDebug()) // debug: true
125
128
126
129
// others
127
130
fmt.Printf("string_value: %s", s.config.GetString("config.values.string_value")) // string_value: test
0 commit comments