diff --git a/meson_options.txt b/meson_options.txt index f45184c..1d9e440 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,2 @@ option('base_url', type: 'string', value: 'https://api.originsro.org') +option('def_sqlite_db_name', type: 'string', value: 'originsro.db3') diff --git a/src/app_config.cpp b/src/app_config.cpp index 862b62e..4a3850b 100644 --- a/src/app_config.cpp +++ b/src/app_config.cpp @@ -41,11 +41,11 @@ std::string_view AppConfig::db_path() const { const auto& map = m_ini.parsed(); auto it_section = map.find("main"); if (map.end() == it_section) - return ""; + return g_def_sqlite_db_name; auto it_setting = it_section->second.find("db_path"); if (it_section->second.end() == it_setting) - return ""; + return g_def_sqlite_db_name; return it_setting->second; } diff --git a/src/config.hpp.in b/src/config.hpp.in index 0ff958a..c1b57ba 100644 --- a/src/config.hpp.in +++ b/src/config.hpp.in @@ -21,5 +21,6 @@ namespace duck { constexpr const char g_base_url[] = @BASE_URL@; constexpr const char g_config_file_path[] = @CONFIG_FILE_PATH@; +constexpr const char g_def_sqlite_db_name[] = @DEF_SQLITE_DB_NAME@; } //namespace duck diff --git a/src/meson.build b/src/meson.build index daa8360..914c6f2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -22,6 +22,7 @@ endif conf = configuration_data() conf.set_quoted('BASE_URL', base_url) conf.set_quoted('CONFIG_FILE_PATH', get_option('prefix') / get_option('sysconfdir') / meson.project_name() + '.conf') +conf.set_quoted('DEF_SQLITE_DB_NAME', get_option('def_sqlite_db_name')) project_config_file = configure_file( input: 'config.hpp.in', output: meson.project_name() + '_config.hpp',