Fix database not found
This commit is contained in:
parent
3d39375b99
commit
d411f4ec38
2 changed files with 2 additions and 2 deletions
|
|
@ -57,7 +57,7 @@ func init() {
|
|||
rootCmd.PersistentFlags().Bool(flagHeaders, false, flagHeadersDescription)
|
||||
|
||||
// config file options
|
||||
rootCmd.PersistentFlags().String(flagSqlite, "", flagSqliteDescription)
|
||||
rootCmd.PersistentFlags().String(flagSqlite, conf.Database.Dsn, flagSqliteDescription)
|
||||
bindP(rootCmd, "database.dsn", flagSqlite)
|
||||
|
||||
rootCmd.PersistentFlags().StringP("log", "l", "info", "Log level (fatal, error, warn, info, debug, trace)")
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func configureEnvironment(cmd *cobra.Command, conf config) (err error) {
|
|||
|
||||
// setup persistence
|
||||
if err == nil && conf.Database.Dsn != "" {
|
||||
if flag := cmd.Flags().Lookup(flagSqlite); flag.Changed {
|
||||
if flag := cmd.Flags().Lookup(flagSqlite); flag != nil && flag.Changed {
|
||||
conf.Database.Type = "sqlite"
|
||||
conf.Database.Dsn = flag.Value.String()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue