summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-09 16:43:16 -0600
committermo khan <mo@mokhan.ca>2025-06-09 16:43:16 -0600
commit2ef774d4c52b9fb0ae0d1717b7a3568b76bccf3d (patch)
treefde8c20a9333e68d7e798ec5936630375da2a1f9 /src/config.rs
parentb39a50e3ec622294cc0b6f271f1996a89f1849d6 (diff)
refactor: split types into separate files
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..3976d71
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,22 @@
+#[derive(Debug, Clone)]
+pub struct Config {
+ pub bind_addr: String,
+ pub issuer_url: String,
+ pub jwt_secret: String,
+}
+
+impl Config {
+ pub fn from_env() -> Self {
+ let bind_addr = std::env::var("BIND_ADDR").unwrap_or_else(|_| "127.0.0.1:7878".to_string());
+ let issuer_url = format!("http://{}", bind_addr);
+ let jwt_secret = std::env::var("JWT_SECRET").unwrap_or_else(|_| {
+ "your-256-bit-secret-key-here-make-it-very-long-and-secure".to_string()
+ });
+
+ Self {
+ bind_addr,
+ issuer_url,
+ jwt_secret,
+ }
+ }
+} \ No newline at end of file