Skip to content

Commit

Permalink
feat: few renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebigard committed Mar 17, 2023
1 parent 0ac9499 commit 8ed2b37
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ version: "2.4"
services:
server:
environment:
- PILOTAGE_POSTGRES_URI={{ vault[env_type].PILOTAGE_POSTGRES_URI }}
- PILOTAGE_ENV=production
- PILOTAGE_LOG_LEVEL=info
- PILOTAGE_LOG_DESTINATIONS=stdout,mongodb,slack
- PILOTAGE_PUBLIC_URL=https://pilotage.trajectoirespro.beta.gouv.fr
- PILOTAGE_SLACK_WEBHOOK_URL={{ vault[env_type].PILOTAGE_SLACK_WEBHOOK_URL }}
- PILOTAGE_API_KEY={{ vault[env_type].PILOTAGE_API_KEY }}
- PILOTAGE_AUTH_PASSWORD_HASH_ROUNDS={{ vault[env_type].PILOTAGE_AUTH_PASSWORD_HASH_ROUNDS }}
- PILOTAGE_AUTH_USER_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_USER_JWT_SECRET }}
- PILOTAGE_AUTH_PDS_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_PDS_JWT_SECRET }}
- PILOTAGE_AUTH_ACTIVATION_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_ACTIVATION_JWT_SECRET }}
- PILOTAGE_AUTH_PASSWORD_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_PASSWORD_JWT_SECRET }}
- PILOTAGE_OVH_STORAGE_NAME={{ vault[env_type].PILOTAGE_OVH_STORAGE_NAME }}
- PILOTAGE_OVH_STORAGE_URI={{ vault[env_type].PILOTAGE_OVH_STORAGE_URI }}
- PILOTAGE_OVH_STORAGE_ENCRYPTION_KEY={{ vault[env_type].PILOTAGE_OVH_STORAGE_ENCRYPTION_KEY }}
- PILOTAGE_API_ENTREPRISE_KEY={{ vault[env_type].PILOTAGE_API_ENTREPRISE_KEY }}
- PILOTAGE_CLAMAV_URI=clamav:3310
- PILOTAGE_IS_OFFLINE=false
- PILOTAGE_INSERJEUNES_USERNAME={{ vault[env_type].PILOTAGE_INSERJEUNES_USERNAME }}
- PILOTAGE_INSERJEUNES_PASSWORD={{ vault[env_type].PILOTAGE_INSERJEUNES_PASSWORD }}
- MNA_BAL_POSTGRES_URI={{ vault[env_type].MNA_BAL_POSTGRES_URI }}
- MNA_BAL_ENV=production
- MNA_BAL_LOG_LEVEL=info
- MNA_BAL_LOG_DESTINATIONS=stdout,mongodb,slack
- MNA_BAL_PUBLIC_URL=https://pilotage.trajectoirespro.beta.gouv.fr
- MNA_BAL_SLACK_WEBHOOK_URL={{ vault[env_type].MNA_BAL_SLACK_WEBHOOK_URL }}
- MNA_BAL_API_KEY={{ vault[env_type].MNA_BAL_API_KEY }}
- MNA_BAL_AUTH_PASSWORD_HASH_ROUNDS={{ vault[env_type].MNA_BAL_AUTH_PASSWORD_HASH_ROUNDS }}
- MNA_BAL_AUTH_USER_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_USER_JWT_SECRET }}
- MNA_BAL_AUTH_PDS_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_PDS_JWT_SECRET }}
- MNA_BAL_AUTH_ACTIVATION_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_ACTIVATION_JWT_SECRET }}
- MNA_BAL_AUTH_PASSWORD_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_PASSWORD_JWT_SECRET }}
- MNA_BAL_OVH_STORAGE_NAME={{ vault[env_type].MNA_BAL_OVH_STORAGE_NAME }}
- MNA_BAL_OVH_STORAGE_URI={{ vault[env_type].MNA_BAL_OVH_STORAGE_URI }}
- MNA_BAL_OVH_STORAGE_ENCRYPTION_KEY={{ vault[env_type].MNA_BAL_OVH_STORAGE_ENCRYPTION_KEY }}
- MNA_BAL_API_ENTREPRISE_KEY={{ vault[env_type].MNA_BAL_API_ENTREPRISE_KEY }}
- MNA_BAL_CLAMAV_URI=clamav:3310
- MNA_BAL_IS_OFFLINE=false
- MNA_BAL_INSERJEUNES_USERNAME={{ vault[env_type].MNA_BAL_INSERJEUNES_USERNAME }}
- MNA_BAL_INSERJEUNES_PASSWORD={{ vault[env_type].MNA_BAL_INSERJEUNES_PASSWORD }}

ui:
build:
Expand All @@ -34,7 +34,7 @@ services:

postgres:
environment:
- POSTGRES_PASSWORD={{ vault[env_type].PILOTAGE_POSTGRES_PASSWORD }}
- POSTGRES_PASSWORD={{ vault[env_type].MNA_BAL_POSTGRES_PASSWORD }}

metabase:
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ version: "2.4"
services:
server:
environment:
- PILOTAGE_POSTGRES_URI={{ vault[env_type].PILOTAGE_POSTGRES_URI }}
- PILOTAGE_ENV=recette
- PILOTAGE_LOG_LEVEL=info
- PILOTAGE_LOG_DESTINATIONS=stdout,mongodb
- PILOTAGE_PUBLIC_URL=https://pilotage-recette.trajectoirespro.beta.gouv.fr
- PILOTAGE_SLACK_WEBHOOK_URL={{ vault[env_type].PILOTAGE_SLACK_WEBHOOK_URL }}
- PILOTAGE_API_KEY={{ vault[env_type].PILOTAGE_API_KEY }}
- PILOTAGE_AUTH_PASSWORD_HASH_ROUNDS={{ vault[env_type].PILOTAGE_AUTH_PASSWORD_HASH_ROUNDS }}
- PILOTAGE_AUTH_USER_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_USER_JWT_SECRET }}
- PILOTAGE_AUTH_PDS_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_PDS_JWT_SECRET }}
- PILOTAGE_AUTH_ACTIVATION_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_ACTIVATION_JWT_SECRET }}
- PILOTAGE_AUTH_PASSWORD_JWT_SECRET={{ vault[env_type].PILOTAGE_AUTH_PASSWORD_JWT_SECRET }}
- PILOTAGE_OVH_STORAGE_URI={{ vault[env_type].PILOTAGE_OVH_STORAGE_URI }}
- PILOTAGE_OVH_STORAGE_ENCRYPTION_KEY={{ vault[env_type].PILOTAGE_OVH_STORAGE_ENCRYPTION_KEY }}
- PILOTAGE_API_ENTREPRISE_KEY={{ vault[env_type].PILOTAGE_API_ENTREPRISE_KEY }}
- PILOTAGE_CLAMAV_URI=clamav:3310
- PILOTAGE_IS_OFFLINE=false
- PILOTAGE_INSERJEUNES_USERNAME={{ vault[env_type].PILOTAGE_INSERJEUNES_USERNAME }}
- PILOTAGE_INSERJEUNES_PASSWORD={{ vault[env_type].PILOTAGE_INSERJEUNES_PASSWORD }}
- MNA_BAL_POSTGRES_URI={{ vault[env_type].MNA_BAL_POSTGRES_URI }}
- MNA_BAL_ENV=recette
- MNA_BAL_LOG_LEVEL=info
- MNA_BAL_LOG_DESTINATIONS=stdout,mongodb
- MNA_BAL_PUBLIC_URL=https://pilotage-recette.trajectoirespro.beta.gouv.fr
- MNA_BAL_SLACK_WEBHOOK_URL={{ vault[env_type].MNA_BAL_SLACK_WEBHOOK_URL }}
- MNA_BAL_API_KEY={{ vault[env_type].MNA_BAL_API_KEY }}
- MNA_BAL_AUTH_PASSWORD_HASH_ROUNDS={{ vault[env_type].MNA_BAL_AUTH_PASSWORD_HASH_ROUNDS }}
- MNA_BAL_AUTH_USER_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_USER_JWT_SECRET }}
- MNA_BAL_AUTH_PDS_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_PDS_JWT_SECRET }}
- MNA_BAL_AUTH_ACTIVATION_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_ACTIVATION_JWT_SECRET }}
- MNA_BAL_AUTH_PASSWORD_JWT_SECRET={{ vault[env_type].MNA_BAL_AUTH_PASSWORD_JWT_SECRET }}
- MNA_BAL_OVH_STORAGE_URI={{ vault[env_type].MNA_BAL_OVH_STORAGE_URI }}
- MNA_BAL_OVH_STORAGE_ENCRYPTION_KEY={{ vault[env_type].MNA_BAL_OVH_STORAGE_ENCRYPTION_KEY }}
- MNA_BAL_API_ENTREPRISE_KEY={{ vault[env_type].MNA_BAL_API_ENTREPRISE_KEY }}
- MNA_BAL_CLAMAV_URI=clamav:3310
- MNA_BAL_IS_OFFLINE=false
- MNA_BAL_INSERJEUNES_USERNAME={{ vault[env_type].MNA_BAL_INSERJEUNES_USERNAME }}
- MNA_BAL_INSERJEUNES_PASSWORD={{ vault[env_type].MNA_BAL_INSERJEUNES_PASSWORD }}

ui:
build:
Expand All @@ -33,7 +33,7 @@ services:

postgres:
environment:
- POSTGRES_PASSWORD={{ vault[env_type].PILOTAGE_POSTGRES_PASSWORD }}
- POSTGRES_PASSWORD={{ vault[env_type].MNA_BAL_POSTGRES_PASSWORD }}

metabase:
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function backup() {
echo "Creating backup..."
mkdir -p "${BACKUP_LOCAL_DIR}"
# bash /opt/pilotage/server-yarn.sh zipStorage | bash "${SCRIPT_DIR}/gpg/encrypt.sh" >"${BACKUP_FILE}"
docker exec pilotage_mongodb bash -c "mongodump --gzip --archive -u backup -p {{ vault[env_type].PILOTAGE_MONGODB_BACKUP_PASSWORD }}" \
docker exec pilotage_mongodb bash -c "mongodump --gzip --archive -u backup -p {{ vault[env_type].MNA_BAL_MONGODB_BACKUP_PASSWORD }}" \
| bash "${SCRIPT_DIR}/gpg/encrypt.sh" >"${BACKUP_FILE}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

readonly TEXT_MESSAGE=${1:?"Please provide a text message"}
readonly SLACK_URL="{{ vault[env_type].PILOTAGE_SLACK_WEBHOOK_URL }}"
readonly SLACK_URL="{{ vault[env_type].MNA_BAL_SLACK_WEBHOOK_URL }}"
readonly CHANNEL_NAME="#pilotage-alerting"
readonly MNA_ENV=$(cat /env)

Expand Down
4 changes: 2 additions & 2 deletions .infra/ansible/roles/setup/tasks/_create-sudoers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- name: "Création utilisateur {{ habilitation.username }}"
user:
name: "{{ habilitation.username }}"
password: "{{ vault[env_type].PILOTAGE_HABILITATION_PASSWORD }}"
password: "{{ vault[env_type].MNA_BAL_HABILITATION_PASSWORD }}"
update_password: on_create
shell: /bin/bash
groups: sudo,mna
Expand All @@ -21,7 +21,7 @@
authorized_key:
user: "{{ habilitation.username }}"
state: present
key: '{{key}}'
key: "{{key}}"
loop: "{{ habilitation.authorized_keys }}"
loop_control:
loop_var: key
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Mission Apprentissage
Copyright (c) 2023 Mission Apprentissage

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PILOTAGE
# BAL

### Pré-requis

Expand All @@ -18,5 +18,4 @@ Cette commande démarre les containers définis dans le fichier `docker-compose.

L'application est ensuite accessible à l'url [http://localhost](http://localhost)


![](https://avatars1.githubusercontent.com/u/63645182?s=200&v=4)
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:
depends_on:
- postgres
environment:
- bal_LOG_DESTINATIONS=stdout,mongodb
- MNA_BAL_LOG_DESTINATIONS=stdout,mongodb

postgres:
image: postgres:14.2
Expand Down
12 changes: 9 additions & 3 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const mainConfig = {
branches: ["main", { name: "develop", channel: "beta", prerelease: "beta" }],
repositoryUrl: "https://github.com/mission-apprentissage/tjp-pilotage.git",
repositoryUrl: "https://github.com/mission-apprentissage/bal.git",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand All @@ -20,7 +20,13 @@ const mainConfig = {
[
"@semantic-release/git",
{
assets: ["ui/package.json", "server/package.json", "ui/CHANGELOG.md", "CHANGELOG.md", "package.json"],
assets: [
"ui/package.json",
"server/package.json",
"ui/CHANGELOG.md",
"CHANGELOG.md",
"package.json",
],
message:
// eslint-disable-next-line no-template-curly-in-string
"chore(release): bump ${nextRelease.version}",
Expand Down Expand Up @@ -60,7 +66,7 @@ const localConfig = {
prerelease: channel,
},
],
repositoryUrl: "https://github.com/mission-apprentissage/tjp-pilotage.git",
repositoryUrl: "https://github.com/mission-apprentissage/bal.git",
plugins: ["@semantic-release/commit-analyzer"],
};

Expand Down
12 changes: 6 additions & 6 deletions server/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import "dotenv/config";

import env from "env-var";
export const config = {
PILOTAGE_POSTGRES_URI: env
.get("PILOTAGE_POSTGRES_URI")
MNA_BAL_POSTGRES_URI: env
.get("MNA_BAL_POSTGRES_URI")
.default("local")
.asString(),
PILOTAGE_INSERJEUNES_USERNAME: env
.get("PILOTAGE_INSERJEUNES_USERNAME")
MNA_BAL_INSERJEUNES_USERNAME: env
.get("MNA_BAL_INSERJEUNES_USERNAME")
.required()
.asString(),
PILOTAGE_INSERJEUNES_PASSWORD: env
.get("PILOTAGE_INSERJEUNES_PASSWORD")
MNA_BAL_INSERJEUNES_PASSWORD: env
.get("MNA_BAL_INSERJEUNES_PASSWORD")
.required()
.asString(),
};
2 changes: 1 addition & 1 deletion server/knexfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const defaultConfig = {
client: "pg",
connection: process.env.PILOTAGE_POSTGRES_URI,
connection: process.env.MNA_BAL_POSTGRES_URI,
migrations: { directory: "dist/migrations" },
};

Expand Down
2 changes: 1 addition & 1 deletion server/src/db/zapatos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { conditions } from "zapatos/db";
import { config } from "../../config/config";

const pool = new pg.Pool({
connectionString: config.PILOTAGE_POSTGRES_URI,
connectionString: config.MNA_BAL_POSTGRES_URI,
});

pool.on("error", (err) => console.error(err)); // don't let a pg restart kill your app
Expand Down
4 changes: 2 additions & 2 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ server.register(
{ prefix: "/api" }
);

if (process.env.PILOTAGE_ENV !== "dev") {
if (process.env.MNA_BAL_ENV !== "dev") {
const knexClient = knex({
client: "pg",
connection: config.PILOTAGE_POSTGRES_URI,
connection: config.MNA_BAL_POSTGRES_URI,
});

knexClient.migrate
Expand Down
2 changes: 1 addition & 1 deletion server/src/modules/core/db/zapatos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { conditions } from "zapatos/db";
import { config } from "../../../../config/config";

const pool = new pg.Pool({
connectionString: config.PILOTAGE_POSTGRES_URI,
connectionString: config.MNA_BAL_POSTGRES_URI,
});

pool.on("error", (err) => console.error(err)); // don't let a pg restart kill your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const instance = axios.create({
export const login = async () => {
const response = await instance.post("/login", undefined, {
headers: {
username: config.PILOTAGE_INSERJEUNES_USERNAME,
password: config.PILOTAGE_INSERJEUNES_PASSWORD,
username: config.MNA_BAL_INSERJEUNES_USERNAME,
password: config.MNA_BAL_INSERJEUNES_PASSWORD,
},
});
const { access_token: token } = response.data;
Expand Down
2 changes: 1 addition & 1 deletion server/zapatosconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"db": {
"connectionString": "{{PILOTAGE_POSTGRES_URI}}"
"connectionString": "{{MNA_BAL_POSTGRES_URI}}"
},
"outDir": "./src"
}

0 comments on commit 8ed2b37

Please sign in to comment.