Skip to content
Merged
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
2 changes: 1 addition & 1 deletion sidecar/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
target/
identities.json
identities*.json
identities.example.json
2 changes: 1 addition & 1 deletion sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
COPY Cargo.toml Cargo.lock* ./
COPY src ./src

RUN cargo build --release
RUN cargo test --locked --release && cargo build --locked --release

FROM debian:trixie-slim

Expand Down
18 changes: 15 additions & 3 deletions sidecar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@ async fn main() -> eyre::Result<()> {
)
.init();

let config_path = std::env::var("CONFIG_PATH").unwrap_or_else(|_| "identities.json".into());
tracing::info!("Loading config from {config_path}");
let sidecar_config = SidecarConfig::load(&config_path)?;
// Managed runtimes can inject the identity configuration from a secret without
// baking seeds or credentials into the container image.
let sidecar_config = match std::env::var("SIDECAR_CONFIG_JSON") {
Ok(json) => {
tracing::info!("Loading config from SIDECAR_CONFIG_JSON");
serde_json::from_str::<SidecarConfig>(&json)?
}
Err(std::env::VarError::NotPresent) => {
let config_path =
std::env::var("CONFIG_PATH").unwrap_or_else(|_| "identities.json".into());
tracing::info!("Loading config from {config_path}");
SidecarConfig::load(&config_path)?
}
Err(error) => return Err(error.into()),
};

// Load proof materials once (shared across all identities).
// These are the Groth16 circuit keys embedded in the binary.
Expand Down
Loading