-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
database configuration abstraction is very leaky #2945
Labels
bug
Something isn't working
Comments
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 7, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment varible is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 7, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
To do this in a non-breaking way, #[serde(with = "either::serde_untagged")]
pub database: Either<String, DatabaseConfig> could be used. |
If the maintainers are interested in a change to address this issue, I'd be happy to try to contribute it. |
Sure, contributions are always welcome. |
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 12, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 12, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 12, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 12, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 13, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 13, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
CobaltCause
added a commit
to CobaltCause/nixpkgs
that referenced
this issue
Jun 14, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
12 tasks
happysalada
pushed a commit
to NixOS/nixpkgs
that referenced
this issue
Jun 15, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945
github-actions bot
pushed a commit
to NixOS/nixpkgs
that referenced
this issue
Jun 15, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945 (cherry picked from commit 7621077)
happysalada
pushed a commit
to NixOS/nixpkgs
that referenced
this issue
Jun 16, 2023
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: LemmyNet/lemmy#2945 (cherry picked from commit 7621077)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lemmy/crates/utils/src/settings/mod.rs
Lines 45 to 55 in e97c30b
This doesn't handle the use of unix domain sockets properly, for example. It looks like converting everything into a connection URI is forced upon you by the database connection management crate being used by this function signature. As such, it might be best/easiest to change
lemmy/crates/utils/src/settings/structs.rs
Line 11 in e97c30b
to
pub database: String
(which would then take a connection URI from the file without having to transform it) to reflect this, instead of trying to expose a structured interface but failing to handle the possible options.I know the
LEMMY_DATABASE_URL
environment variable exists and can take a raw connection URI without transforming it, but I think the file configuration should be able to be just as powerful as the environment variable. Having to use the environment variable just to work around this issue feels pretty hacky.The text was updated successfully, but these errors were encountered: