From f0fd48389ca3121e5de1a893d2feeab3fecab771 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:49:54 +0100 Subject: [PATCH] feat: add permit args to docker stack --- Makefile | 3 --- auth/src/args.rs | 2 +- docker-compose.dev.yml | 2 ++ docker-compose.yml | 5 +++++ gateway/src/args.rs | 9 +++++++++ gateway/src/lib.rs | 3 +++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4fde158985..788bd03805 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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 diff --git a/auth/src/args.rs b/auth/src/args.rs index fea1391d56..7bb273422d 100644 --- a/auth/src/args.rs +++ b/auth/src/args.rs @@ -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, } diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index ec53aaac70..631bc42309 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index fef4753771..155fa4a910 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -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 diff --git a/gateway/src/args.rs b/gateway/src/args.rs index 51f2adf222..31f6336866 100644 --- a/gateway/src/args.rs +++ b/gateway/src/args.rs @@ -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, diff --git a/gateway/src/lib.rs b/gateway/src/lib.rs index 8f39aad1a0..e2ad0603ec 100644 --- a/gateway/src/lib.rs +++ b/gateway/src/lib.rs @@ -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()],