File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"io/ioutil"
13
13
"os"
14
14
"path/filepath"
15
+ "strconv"
15
16
"strings"
16
17
"time"
17
18
)
@@ -82,6 +83,12 @@ func main() {
82
83
// start stress tests if any
83
84
beginStressTest (viper .GetInt ("stress-cpu" ), viper .GetInt ("stress-memory" ), logger )
84
85
86
+ // validate port
87
+ if _ , err := strconv .Atoi (viper .GetString ("port" )); err != nil {
88
+ port , _ := fs .GetInt ("port" )
89
+ viper .Set ("port" , strconv .Itoa (port ))
90
+ }
91
+
85
92
// load HTTP server config
86
93
var srvCfg api.Config
87
94
if err := viper .Unmarshal (& srvCfg ); err != nil {
@@ -92,7 +99,7 @@ func main() {
92
99
logger .Info ("Starting podinfo" ,
93
100
zap .String ("version" , viper .GetString ("version" )),
94
101
zap .String ("revision" , viper .GetString ("revision" )),
95
- zap .String ("port" , viper . GetString ( "port" ) ),
102
+ zap .String ("port" , srvCfg . Port ),
96
103
)
97
104
98
105
// start HTTP server
You can’t perform that action at this time.
0 commit comments