diff --git a/.devcontainer/.env b/.devcontainer/.env new file mode 100644 index 000000000..91c93d91d --- /dev/null +++ b/.devcontainer/.env @@ -0,0 +1 @@ +MAS_OAUTH2_ISSUER="https://${CODESPACE_NAME}-8080.githubpreview.dev/" \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 141cb39ae..421130224 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,6 +3,8 @@ FROM mcr.microsoft.com/vscode/devcontainers/rust:0-1 RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends postgresql-client +COPY .env /.env + # TODO: pre-build custom images, those take too much time #RUN cargo install sqlx-cli --no-default-features --features postgres #RUN cargo install cargo-edit \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1aaa2d9d7..245c68a2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1255,6 +1255,7 @@ dependencies = [ "cookie", "crc 2.0.0", "data-encoding", + "dotenv", "figment", "headers", "hyper", diff --git a/matrix-authentication-service/Cargo.toml b/matrix-authentication-service/Cargo.toml index cdec109e5..a9c9a4f5e 100644 --- a/matrix-authentication-service/Cargo.toml +++ b/matrix-authentication-service/Cargo.toml @@ -39,6 +39,7 @@ serde_with = { version = "1.9.4", features = ["hex", "chrono"] } clap = "3.0.0-beta.2" figment = { version = "0.10.6", features = ["env", "yaml", "test"] } schemars = { version = "0.8.3", features = ["url", "chrono"] } +dotenv = "0.15.0" # Password hashing argon2 = { version = "0.2.2", features = ["password-hash"] } diff --git a/matrix-authentication-service/src/main.rs b/matrix-authentication-service/src/main.rs index f3adcadc6..068ccc598 100644 --- a/matrix-authentication-service/src/main.rs +++ b/matrix-authentication-service/src/main.rs @@ -34,6 +34,9 @@ use self::cli::RootCommand; #[tokio::main] async fn main() -> anyhow::Result<()> { + // Load environment variables from .env files + dotenv::dotenv()?; + // Setup logging & tracing let fmt_layer = tracing_subscriber::fmt::layer(); let filter_layer = EnvFilter::try_from_default_env().or_else(|_| EnvFilter::try_new("info"))?;