summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 6b31f92..9e5c414 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,12 +1,9 @@
use sts::http::Server;
+use sts::Config;
fn main() {
- let bind_addr: String = match std::env::var("BIND_ADDR") {
- Ok(val) => val,
- Err(_) => String::from("127.0.0.1:7878"),
- };
-
- let server = Server::new(bind_addr).expect("Failed to create server");
+ let config = Config::from_env();
+ let server = Server::new(config).expect("Failed to create server");
server.start();
}
@@ -17,7 +14,10 @@ mod tests {
#[test]
fn test_oauth_server_creation() {
- let server = sts::http::Server::new("127.0.0.1:0".to_string());
+ let mut config = sts::Config::from_env();
+ config.bind_addr = "127.0.0.1:0".to_string();
+ config.issuer_url = format!("http://{}", config.bind_addr);
+ let server = sts::http::Server::new(config);
assert!(server.is_ok());
}