Skip to content

Commit

Permalink
🚧 WIP Migrate from Rocket to Axum
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed Aug 24, 2024
1 parent 2660d40 commit ff260f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/helpers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub const THEME_NAME: &str = "Orangutan";
pub const DATA_FILE_EXTENSION: &str = "orangutan";
pub const DEFAULT_PROFILE: &str = "_default";
pub const ROOT_KEY_NAME: &'static str = "_biscuit_root";
pub const COOKIE_KEY_ENV_VAR_NAME: &'static str = "COOKIE_ENCRYPTION_KEY";

pub(super) const WEBSITE_DIR_NAME: &'static str = "website";

Expand Down
9 changes: 8 additions & 1 deletion src/orangutan-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use axum::{
};
use axum_extra::extract::cookie::Key;
use orangutan_helpers::{
config::COOKIE_KEY_ENV_VAR_NAME,
generate::{self, *},
website_id::WebsiteId,
};
Expand Down Expand Up @@ -63,7 +64,13 @@ async fn main() -> ExitCode {
let mut app_state = AppState {
website_root,
// FIXME: Use predefined key.
cookie_key: Key::generate(),
cookie_key: Key::from(
std::env::var(COOKIE_KEY_ENV_VAR_NAME)
.expect(&format!(
"Environment variable '{COOKIE_KEY_ENV_VAR_NAME}' not defined."
))
.as_bytes(),
),
#[cfg(feature = "templating")]
tera: Default::default(),
};
Expand Down

0 comments on commit ff260f9

Please sign in to comment.