aboutsummaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-24 19:22:01 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-24 19:22:01 +0200
commit2fc5931a6ce9bbb75757c4a20022b19778bd91c5 (patch)
tree22dec1279ac77bb14a07a7ce4cbd4583756a6fdb /server/src/main.rs
parentf4f3a16bca576c202887799066bd896863612e2b (diff)
downloadjellything-2fc5931a6ce9bbb75757c4a20022b19778bd91c5.tar
jellything-2fc5931a6ce9bbb75757c4a20022b19778bd91c5.tar.bz2
jellything-2fc5931a6ce9bbb75757c4a20022b19778bd91c5.tar.zst
move db to jellybase
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 2b2d2c0..7c868a9 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -6,15 +6,16 @@
#![feature(lazy_cell)]
#![feature(int_roundings)]
-use crate::routes::ui::admin::log::enable_logging;
+use crate::routes::ui::{account::hash_password, admin::log::enable_logging};
use database::Database;
use federation::Federation;
use jellybase::CONF;
+use jellycommon::user::{PermissionSet, Theme, User};
use log::{error, warn};
use routes::build_rocket;
use tokio::fs::create_dir_all;
-pub mod database;
+pub use jellybase::database;
pub mod federation;
pub mod import;
pub mod routes;
@@ -28,7 +29,21 @@ async fn main() {
create_dir_all(&CONF.cache_path).await.unwrap();
let database = Database::open(&CONF.database_path).unwrap();
let federation = Federation::initialize();
- database.create_admin();
+
+ database
+ .user
+ .insert(
+ &CONF.admin_username,
+ &User {
+ admin: true,
+ theme: Theme::Dark,
+ display_name: "Admin".to_string(),
+ name: CONF.admin_username.clone(),
+ password: hash_password(&CONF.admin_username, &CONF.admin_password),
+ permissions: PermissionSet::default(),
+ },
+ )
+ .unwrap();
// if let Err(err) = import::import(&database, &federation).await {
// log::error!("import not sucessful: {err:?}")
// }