|
1 |
| -// Copyright © 2018 Servian |
| 1 | +// Copyright © 2020 Servian |
2 | 2 | //
|
3 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 | 4 | // of this software and associated documentation files (the "Software"), to deal
|
|
21 | 21 | package cmd
|
22 | 22 |
|
23 | 23 | import (
|
24 |
| - "fmt" |
25 |
| - "os" |
| 24 | + "fmt" |
| 25 | + "os" |
26 | 26 |
|
27 |
| - "github.com/servian/TechTestApp/config" |
28 |
| - "github.com/servian/TechTestApp/daemon" |
29 |
| - "github.com/spf13/cobra" |
| 27 | + "github.com/servian/TechTestApp/config" |
| 28 | + "github.com/servian/TechTestApp/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: "TechTestApp", |
38 |
| - Short: "Application used to test potential candidates at Servian", |
39 |
| - Long: ` |
40 |
| -.:ooooool, .:odddddl;. .;ooooc. .l, ;c. ::. 'coddddoc' ,looooooc. |
| 37 | + Use: "TechTestApp", |
| 38 | + Short: "Application used to test potential candidates at Servian", |
| 39 | + Long: ` |
| 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:
|
43 | 43 | .oOxc,. lKl...........oK: :Kc l0; :Kc .kk. .Ok. .kO. '0d '0d
|
44 | 44 | .;ldddo;. oXkdddddddddddxx, :Kc .kk. .Ox. .kk. '0d d0' '0d '0d
|
45 |
| - .cOk. lKc :Kc :0l o0; .kk. .Ok. .k0' '0d '0d |
46 |
| - cXc .xO; .. :Kc .d0' ;0o .kk. :0d. .dN0' '0d '0d |
| 45 | + .cOk. lKc :Kc :0l o0; .kk. .Ok. .k0' '0d '0d |
| 46 | + cXc .xO; .. :Kc .d0' ;0o .kk. :0d. .dN0' '0d '0d |
47 | 47 | ,c,....'cOx. .lOxc,...':dkc. :Kc 'Ox',kk. .kk. ,xko;'..';okk00, '0d '0d ';;;;;;;;;;,.
|
48 | 48 | 'looooool;. .;ldddddo:. 'l' .lool. :: 'coddddoc'.;l. .l; .c; .cxxxxxxxxxxo.
|
49 | 49 |
|
50 | 50 | This application is used as part of testing potential candiates at Sevian.
|
51 | 51 |
|
52 | 52 | Please visit http://Servian.com for more details`,
|
53 |
| - Version: "0.5.0", |
| 53 | + Version: "0.6.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