Skip to content

Commit

Permalink
feat: add permit args to docker stack
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Mar 21, 2024
1 parent 3aa60be commit f0fd483
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ MONGO_INITDB_ROOT_USERNAME?=mongodb
MONGO_INITDB_ROOT_PASSWORD?=password
STRIPE_SECRET_KEY?=""
AUTH_JWTSIGNING_PRIVATE_KEY?=""

PERMIT_API?=https://api.eu-central-1.permit.io
PERMIT_API_KEY?=""

DD_ENV=$(SHUTTLE_ENV)
Expand Down Expand Up @@ -131,7 +129,6 @@ DOCKER_COMPOSE_ENV=\
DOCKER_SOCK=$(DOCKER_SOCK)\
SHUTTLE_ENV=$(SHUTTLE_ENV)\
SHUTTLE_SERVICE_VERSION=$(SHUTTLE_SERVICE_VERSION)\
PERMIT_API=$(PERMIT_API)\
PERMIT_API_KEY=$(PERMIT_API_KEY)

.PHONY: clean deep-clean images the-shuttle-images shuttle-% postgres otel deploy test docker-compose.rendered.yml up down
Expand Down
2 changes: 1 addition & 1 deletion auth/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct StartArgs {
#[arg(long, default_value = "local")]
pub permit_environment: String,

/// Permit environment to use
/// Permit API key
#[arg(long, default_value = "permit_")]
pub permit_api_key: String,
}
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ services:
- "--stripe-secret-key=${STRIPE_SECRET_KEY}"
# used only for local development
- "--jwt-signing-private-key=LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1DNENBUUF3QlFZREsyVndCQ0lFSUR5V0ZFYzhKYm05NnA0ZGNLTEwvQWNvVUVsbUF0MVVKSTU4WTc4d1FpWk4KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo="
- "--permit-api=https://api.eu-central-1.permit.io"
- "--permit-api-key=${PERMIT_API_KEY}"
otel-collector:
ports:
- 4317:4317
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ services:
- "--address=0.0.0.0:8000"
- "--stripe-secret-key=${STRIPE_SECRET_KEY}"
- "--jwt-signing-private-key=${AUTH_JWTSIGNING_PRIVATE_KEY}"
- "--permit-api=https://api.eu-central-1.permit.io"
- "--permit-api-key=${PERMIT_API_KEY}"
healthcheck:
test: curl -f -s http://localhost:8000
interval: 1m
Expand Down Expand Up @@ -119,6 +121,9 @@ services:
- "--proxy-fqdn=${APPS_FQDN}"
- "--use-tls=${USE_TLS}"
- "--admin-key=${GATEWAY_ADMIN_KEY}"
- "--permit-api=https://api.eu-central-1.permit.io"
- "--permit-api-key=${PERMIT_API_KEY}"
- "--permit-pdp=http://permit-pdp:7000"
healthcheck:
test: curl -f -s http://localhost:8001
interval: 1m
Expand Down
9 changes: 9 additions & 0 deletions gateway/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ pub struct ContextArgs {
/// Maximum number of containers to start on this node before blocking any project
#[arg(long, default_value = "990")]
pub hard_container_limit: u32,
/// Address to the Permit.io API
#[arg(long, default_value = "https://api.eu-central-1.permit.io")]
pub permit_api: Uri,
/// Permit.io API key
#[arg(long)]
pub permit_api_key: String,
/// Address to the local Permit.io PDP
#[arg(long, default_value = "http://permit-pdp:7000")]
pub permit_pdp: Uri,

/// Allow tests to set some extra /etc/hosts
pub extra_hosts: Vec<String>,
Expand Down
3 changes: 3 additions & 0 deletions gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ pub mod tests {
cch_container_limit: 1,
soft_container_limit: 2,
hard_container_limit: 3,
permit_api: Default::default(), // TODO: will need mock?
permit_api_key: Default::default(), // TODO: will need mock?
permit_pdp: Default::default(), // TODO: will need mock?

// Allow access to the auth on the host
extra_hosts: vec!["host.docker.internal:host-gateway".to_string()],
Expand Down

0 comments on commit f0fd483

Please sign in to comment.