Fixes db init call in root cmd
This commit is contained in:
parent
4436b83a15
commit
9fdc8cad49
1 changed files with 5 additions and 3 deletions
|
|
@ -65,6 +65,7 @@ func Execute() {
|
|||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig, initDB)
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default: ~/.config/freed/config.toml)")
|
||||
}
|
||||
|
||||
|
|
@ -101,8 +102,9 @@ func initConfig() {
|
|||
}
|
||||
|
||||
func initDB() {
|
||||
if err := database.Open(appContext.Config.DB.Path); err != nil {
|
||||
fmt.Printf("Could not connect to database: %s", err)
|
||||
os.Exit(1)
|
||||
err := database.Open(appContext.Config.DB.Path)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Could not connect to the database: %s", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue