21
21
package cmd
22
22
23
23
import (
24
- "fmt"
25
- "os"
24
+ "fmt"
25
+ "os"
26
26
27
- "github.com/servian/TechChallengeApp/config"
28
- "github.com/servian/TechChallengeApp/daemon"
29
- "github.com/spf13/cobra"
27
+ "github.com/servian/TechChallengeApp/config"
28
+ "github.com/servian/TechChallengeApp/daemon"
29
+ "github.com/spf13/cobra"
30
30
)
31
31
32
32
var cfgFile string
33
33
var cfg * daemon.Config
34
34
35
35
// rootCmd represents the base command when called without any subcommands
36
36
var rootCmd = & cobra.Command {
37
- Use : "TechChallengeApp" ,
38
- Short : "Application used to test potential candidates at Servian" ,
39
- Long : `
37
+ Use : "TechChallengeApp" ,
38
+ Short : "Application used to test potential candidates at Servian" ,
39
+ Long : `
40
40
.:ooooool, .:odddddl;. .;ooooc. .l, ;c. ::. 'coddddoc' ,looooooc.
41
41
'kk;....';, .lOx:'...,cxkc. .dOc.... .xO' ,0d. .kk. ,xko;....;okx, .xkl,....;dOl.
42
42
:Xl .xO, :0d. ;Kl ,0o .dO' .kk. :0d. .d0: .xO' lK:
@@ -50,37 +50,37 @@ var rootCmd = &cobra.Command{
50
50
This application is used as part of challenging potential candiates at Sevian.
51
51
52
52
Please visit http://Servian.com for more details` ,
53
- Version : "0.8.0" ,
53
+ Version : "0.8.0" ,
54
54
}
55
55
56
56
// Execute adds all child commands to the root command and sets flags appropriately.
57
57
// This is called by main.main(). It only needs to happen once to the rootCmd.
58
58
func Execute () {
59
- if err := rootCmd .Execute (); err != nil {
60
- fmt .Println (err )
61
- os .Exit (1 )
62
- }
59
+ if err := rootCmd .Execute (); err != nil {
60
+ fmt .Println (err )
61
+ os .Exit (1 )
62
+ }
63
63
}
64
64
65
65
func init () {
66
- cobra .OnInitialize (initConfig )
66
+ cobra .OnInitialize (initConfig )
67
67
}
68
68
69
69
// initConfig reads in config file and ENV variables if set.
70
70
func initConfig () {
71
- conf , err := config .LoadConfig ()
71
+ conf , err := config .LoadConfig ()
72
72
73
- if err != nil {
74
- fmt .Print (err )
75
- os .Exit (1 )
76
- }
73
+ if err != nil {
74
+ fmt .Print (err )
75
+ os .Exit (1 )
76
+ }
77
77
78
- cfg = & daemon.Config {}
79
- cfg .UI .DB .DbName = conf .DbName
80
- cfg .UI .DB .DbPassword = conf .DbPassword
81
- cfg .UI .DB .DbUser = conf .DbUser
82
- cfg .UI .DB .DbHost = conf .DbHost
83
- cfg .UI .DB .DbPort = conf .DbPort
84
- cfg .ListenSpec = conf .ListenHost + ":" + conf .ListenPort
78
+ cfg = & daemon.Config {}
79
+ cfg .UI .DB .DbName = conf .DbName
80
+ cfg .UI .DB .DbPassword = conf .DbPassword
81
+ cfg .UI .DB .DbUser = conf .DbUser
82
+ cfg .UI .DB .DbHost = conf .DbHost
83
+ cfg .UI .DB .DbPort = conf .DbPort
84
+ cfg .ListenSpec = conf .ListenHost + ":" + conf .ListenPort
85
85
86
86
}
0 commit comments