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

Remove update and read site config. Fixes #2306 #2329

Merged
merged 2 commits into from
Jun 22, 2022

Conversation

dessalines
Copy link
Member

No description provided.

@dessalines dessalines requested a review from Nutomic as a code owner June 22, 2022 03:47
crates/utils/src/utils.rs Outdated Show resolved Hide resolved
pub fn get() -> Self {
SETTINGS.read().expect("read config").to_owned()
pub fn get() -> &'static Self {
&SETTINGS
}
Copy link
Member

Choose a reason for hiding this comment

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

You can probably remove this get() method, and make SETTINGS public instead. Also, i dont think Settings::init() needs to be public.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll see how big a refactor this would be.

@@ -29,7 +29,7 @@ impl Settings {
/// Note: The env var `LEMMY_DATABASE_URL` is parsed in
/// `lemmy_db_schema/src/lib.rs::get_database_url_from_env()`
/// Warning: Only call this once.
pub fn init() -> Result<Self, LemmyError> {
pub(crate) fn init() -> Result<Self, LemmyError> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Made this crate only.

/// Returns the config as a struct.
pub fn get() -> Self {
SETTINGS.read().expect("read config").to_owned()
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this public get.

@Nutomic Nutomic enabled auto-merge (squash) June 22, 2022 20:02
@Nutomic Nutomic merged commit a745fa6 into main Jun 22, 2022
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.

2 participants