Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DB ID is set if namespaces are enabled #766

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Conversation

avinassh
Copy link
Member

@avinassh avinassh commented Dec 6, 2023

closes #765

@avinassh avinassh marked this pull request as draft December 6, 2023 19:11
Comment on lines +158 to +165
Ok(res) => {
let res = res.trim().to_string();
if res.is_empty() {
bail!("{} environment variable is empty", key)
} else {
Ok(res)
}
}
Copy link
Member Author

@avinassh avinassh Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't trim, then it lets us slip in values containing just spaces or export LIBSQL_BOTTOMLESS_DATABASE_ID=''. I don't think we ever want env variables to have spaces, trimming seems like a must.

@avinassh avinassh marked this pull request as ready for review December 7, 2023 10:19
@@ -155,12 +155,19 @@ impl Options {
pub fn from_env() -> Result<Self> {
fn env_var(key: &str) -> Result<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preemptively acked, but before we merge -- should all env_var callsites disallow empty vars?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avinassh can you double-check before I queue this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psarna hey, let me double check all of the vars if we are using empty vars anywhere

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psarna I have double checked all, we don't expect empty variables to be set anywhere in bottomless

@avinassh avinassh requested a review from psarna December 8, 2023 12:51
@psarna psarna added this pull request to the merge queue Dec 12, 2023
Merged via the queue into main with commit 25b33a3 Dec 12, 2023
12 checks passed
@psarna psarna deleted the 765-ns-bottomless branch December 12, 2023 13:02
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.

Namespace creation accepts empty bottomless_db_id
2 participants