print secrets at start

This commit is contained in:
Alex Janka 2024-02-12 10:04:18 +11:00
parent e75c62bab5
commit 48731f99eb
4 changed files with 8 additions and 5 deletions

2
Cargo.lock generated
View file

@ -1466,7 +1466,7 @@ dependencies = [
[[package]] [[package]]
name = "tesla-auth-callback-watcher" name = "tesla-auth-callback-watcher"
version = "0.2.1" version = "0.2.2"
dependencies = [ dependencies = [
"alex-utils", "alex-utils",
"env_logger", "env_logger",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "tesla-auth-callback-watcher" name = "tesla-auth-callback-watcher"
version = "0.2.1" version = "0.2.2"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,7 +1,7 @@
# Maintainer: Alex Janka <alex@alexjanka.com> # Maintainer: Alex Janka <alex@alexjanka.com>
pkgname=tesla-auth-callback-watcher pkgname=tesla-auth-callback-watcher
pkgver=0.2.1 pkgver=0.2.2
pkgrel=1 pkgrel=1
pkgdesc="server for tesla auth callbacks" pkgdesc="server for tesla auth callbacks"
arch=('x86_64' 'aarch64') arch=('x86_64' 'aarch64')

View file

@ -26,6 +26,7 @@ fn rocket() -> _ {
rocket::build().mount("/", routes![authenticated, deauthenticated, login]) rocket::build().mount("/", routes![authenticated, deauthenticated, login])
} }
#[derive(Debug)]
struct Secrets { struct Secrets {
client_id: String, client_id: String,
client_secret: String, client_secret: String,
@ -35,12 +36,14 @@ struct Secrets {
impl Secrets { impl Secrets {
fn load() -> Option<Self> { fn load() -> Option<Self> {
Some(Self { let secrets = Self {
client_id: std::env::var("CLIENT_ID").ok()?, client_id: std::env::var("CLIENT_ID").ok()?,
client_secret: std::env::var("CLIENT_SECRET").ok()?, client_secret: std::env::var("CLIENT_SECRET").ok()?,
audience: std::env::var("AUDIENCE").ok()?, audience: std::env::var("AUDIENCE").ok()?,
redirect_uri: std::env::var("REDIRECT_URI").ok()?, redirect_uri: std::env::var("REDIRECT_URI").ok()?,
}) };
log::warn!("got secrets: {secrets:#?}");
Some(secrets)
} }
} }