Skip to content

Commit c8aeae9

Browse files
author
a.groshev
committed
int16
1 parent 58c7510 commit c8aeae9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

application/config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ func (c *Configuration) GetInt64(env string) int64 {
7070
return val
7171
}
7272

73+
func (c *Configuration) GetInt16(env string) int16 {
74+
fmt.Printf("GetConfigInt64: %v", env)
75+
envVar := strings.ToUpper(strings.ReplaceAll(env, ".", "_"))
76+
c.configReader.SetDefault(env, c.configReader.GetInt(env))
77+
err := c.configReader.BindEnv(env, envVar)
78+
if err != nil {
79+
panic(err)
80+
}
81+
val := c.configReader.GetInt(env)
82+
fmt.Printf("=%v\n", val)
83+
return int16(val)
84+
}
85+
7386
func (c *Configuration) GetDuration(env string) time.Duration {
7487
fmt.Printf("GetConfigDuration: %v", env)
7588
envVar := strings.ToUpper(strings.ReplaceAll(env, ".", "_"))

0 commit comments

Comments
 (0)