mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-06-02 07:31:03 +00:00
20 lines
505 B
Rust
20 lines
505 B
Rust
use diesel::{result::Error, *};
|
|
use lemmy_db_schema::source::secret::Secret;
|
|
|
|
pub trait Secret_ {
|
|
fn init(conn: &PgConnection) -> Result<Secret, Error>;
|
|
}
|
|
|
|
impl Secret_ for Secret {
|
|
/// Initialize the Secrets from the DB.
|
|
/// Warning: You should only call this once.
|
|
fn init(conn: &PgConnection) -> Result<Secret, Error> {
|
|
read_secrets(conn)
|
|
}
|
|
}
|
|
|
|
fn read_secrets(conn: &PgConnection) -> Result<Secret, Error> {
|
|
use lemmy_db_schema::schema::secret::dsl::*;
|
|
secret.first::<Secret>(conn)
|
|
}
|