Skip to content

fix(docs) :: remove DSN=DuckDB from the database_url default - #1421

Open
81reap wants to merge 1 commit into
sqlpage:mainfrom
81reap:mutation/07-config-default
Open

fix(docs) :: remove DSN=DuckDB from the database_url default#1421
81reap wants to merge 1 commit into
sqlpage:mainfrom
81reap:mutation/07-config-default

Conversation

@81reap

@81reap 81reap commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

create_default_database only ever builds a sqlite:// URL, so this isn't a possible default

SQLPage/src/app_config.rs

Lines 633 to 676 in 109b20d

fn create_default_database(configuration_directory: &Path) -> String {
let prefix = "sqlite://".to_owned();
#[cfg(not(feature = "lambda-web"))]
{
let config_dir = cannonicalize_if_possible(configuration_directory);
let old_default_db_path = PathBuf::from(DEFAULT_DATABASE_FILE);
let default_db_path = config_dir.join(DEFAULT_DATABASE_FILE);
if let Ok(true) = old_default_db_path.try_exists() {
log::warn!(
"Your sqlite database in {} is publicly accessible through your web server. Please move it to {}.",
old_default_db_path.display(),
default_db_path.display()
);
return prefix + old_default_db_path.to_str().unwrap();
} else if let Ok(true) = default_db_path.try_exists() {
log::debug!(
"Using the default database file in {}",
default_db_path.display()
);
return prefix + &encode_uri(&default_db_path);
}
// Create the default database file if we can
if let Ok(tmp_file) = std::fs::File::create(&default_db_path) {
log::info!(
"No DATABASE_URL provided, {} is writable, creating a new database file.",
default_db_path.display()
);
drop(tmp_file);
if let Err(e) = std::fs::remove_file(&default_db_path) {
log::debug!(
"Unable to remove temporary probe file. It might have already been removed by another instance started concurrently: {e}"
);
}
return prefix + &encode_uri(&default_db_path) + "?mode=rwc";
}
}
log::warn!(
"No DATABASE_URL provided, and {} is not writeable. Using a temporary in-memory SQLite database. All the data created will be lost when this server shuts down.",
configuration_directory.display()
);
prefix + ":memory:?cache=shared"
}

`create_default_database` only ever builds a `sqlite://` URL, so this isn't a possible default
@81reap
81reap marked this pull request as ready for review September 2, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant