99 "syscall"
1010 "time"
1111
12- "go.uber.org/zap"
13- "github.com/spf13/cobra"
1412 "github.com/MakeNowJust/heredoc"
13+ "github.com/spf13/cobra"
14+ "go.uber.org/zap"
1515
1616 "github.com/PythonHacker24/linux-acl-management-backend/api/routes"
1717 "github.com/PythonHacker24/linux-acl-management-backend/config"
@@ -40,9 +40,9 @@ func exec() error {
4040 ` ),
4141 Run : func (cmd * cobra.Command , args []string ) {
4242 if configPath != "" {
43- fmt .Printf ("Using config file: %s\n " , configPath )
43+ fmt .Printf ("Using config file: %s\n \n " , configPath )
4444 } else {
45- fmt .Println ("No config file provided." )
45+ fmt .Println ("No config file provided.\n \n " )
4646 }
4747 },
4848 }
@@ -61,13 +61,22 @@ func exec() error {
6161 load config file
6262 if there is an error in loading the config file, then it will exit with code 1
6363 */
64- config .LoadConfig (configPath )
64+ if err := config .LoadConfig (configPath ); err != nil {
65+ fmt .Printf ("Configuration Error in %s: %s" ,
66+ configPath ,
67+ err .Error (),
68+ )
69+ /* since the configuration is invalid, don't proceed */
70+ os .Exit (1 )
71+ }
6572
6673 /*
6774 load environment variables
6875 if there is an error or environment variables are not set, then it will exit with code 1
6976 */
7077 config .LoadEnv ()
78+
79+ fmt .Println ("loaded config" )
7180
7281 /*
7382 true for production, false for development mode
0 commit comments