2021-10-16 13:33:38 +00:00
|
|
|
use crate::source::secret::Secret;
|
|
|
|
use diesel::{result::Error, *};
|
|
|
|
|
|
|
|
impl Secret {
|
|
|
|
/// Initialize the Secrets from the DB.
|
|
|
|
/// Warning: You should only call this once.
|
2022-09-26 14:09:32 +00:00
|
|
|
pub fn init(conn: &mut PgConnection) -> Result<Secret, Error> {
|
2021-10-16 13:33:38 +00:00
|
|
|
read_secrets(conn)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
fn read_secrets(conn: &mut PgConnection) -> Result<Secret, Error> {
|
2021-10-16 13:33:38 +00:00
|
|
|
use crate::schema::secret::dsl::*;
|
|
|
|
secret.first::<Secret>(conn)
|
|
|
|
}
|