Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/common/config/src/config/auth.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::secret::Secret;

#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct Auth {
pub admin_token: String,
}

impl Default for Auth {
fn default() -> Self {
Auth {
admin_token: "admin".to_string(),
}
}
pub admin_token: Secret<String>,
}
2 changes: 1 addition & 1 deletion packages/common/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct Root {
impl Default for Root {
fn default() -> Self {
Root {
auth: Some(Auth::default()),
auth: None,
guard: None,
api_public: None,
api_peer: None,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/guard/server/src/routing/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub async fn route_request(
};

// Validate token
if token != auth.admin_token {
if token != auth.admin_token.read() {
return Err(rivet_api_builder::ApiForbidden.build());
}
}
Expand Down
Loading