Skip to content

Commit

Permalink
chore: allow api token auth disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
vmttn committed Sep 29, 2023
1 parent c1a344d commit f7b94a6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
TF_VAR_ssh_private_key: ${{ secrets.ssh_private_key }}
TF_VAR_public_hostname: ${{ vars.PUBLIC_HOSTNAME }}
TF_VAR_airflow__core__fernet_key: ${{ secrets.AIRFLOW__CORE__FERNET_KEY }}
TF_VAR_api_token_enabled: ${{ vars.api_token_enabled }}
ENV: ${{ vars.ENVIRONMENT }}
volumes:
- .:/deployment
Expand Down
1 change: 1 addition & 0 deletions deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ services:
- DATABASE_URL=${AIRFLOW_CONN_PG} # TODO: create dedicated RO creds for api
- SECRET_KEY=${API_SECRET_KEY}
- ROOT_PATH=/api
- TOKEN_ENABLED=${API_TOKEN_ENABLED}

reverse-proxy:
image: traefik:v2.10
Expand Down
6 changes: 6 additions & 0 deletions deployment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ variable "api_version" {
type = string
}

variable "api_token_enabled" {
description = "Whether to enable the api token auth or not"
type = string
}

variable "ssh_private_key" {
description = "The associated public key will be deployed to the instance"
type = string
Expand Down Expand Up @@ -127,6 +132,7 @@ module "stack_data" {
public_hostname = var.public_hostname
airflow__core__fernet_key = var.airflow__core__fernet_key
dora_api_token = var.dora_api_token
api_token_enabled = var.api_token_enabled
}

output "public_ip" {
Expand Down
1 change: 1 addition & 0 deletions deployment/modules/stack_data/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ resource "null_resource" "up" {
SIRENE_STOCK_UNITE_LEGALE_FILE_URL=https://www.data.gouv.fr/fr/datasets/r/825f4199-cadd-486c-ac46-a65a8ea1a047
UN_JEUNE_UNE_SOLUTION_API_URL=https://mes-aides.1jeune1solution.beta.gouv.fr/api/
PUBLIC_HOSTNAME=${var.public_hostname}
API_TOKEN_ENABLED=${var.api_token_enabled}
EOT
)
destination = "${local.work_dir}/deployment/.env"
Expand Down
5 changes: 5 additions & 0 deletions deployment/modules/stack_data/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ variable "dora_api_token" {
type = string
sensitive = true
}

variable "api_token_enabled" {
description = "Whether to enable the api token auth or not"
type = string
}
3 changes: 2 additions & 1 deletion deployment/template.terraform.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"ssh_private_key": null,
"public_hostname": null,
"airflow__core__fernet_key": null,
"dora_api_token": null
"dora_api_token": null,
"api_token_enabled": null
}

0 comments on commit f7b94a6

Please sign in to comment.