From 5bf6c361fd957889baf403eee5bb65c4ec8d9aef Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 6 Aug 2024 07:03:14 +0000 Subject: [PATCH] TEST --- .github/workflows/ci-cd-dev.yml | 3 +++ app.py | 4 ++-- config.py | 3 ++- initialize_db.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd-dev.yml b/.github/workflows/ci-cd-dev.yml index 80d5b9a..b58ece6 100644 --- a/.github/workflows/ci-cd-dev.yml +++ b/.github/workflows/ci-cd-dev.yml @@ -63,6 +63,9 @@ jobs: CLUSTER_NAME: lwitter-dev-cluster SERVICE_NAME: lwitter-dev-service CONTAINER_NAME: lwitter-light-container + DB_USER: ${{ secrets.DB_USER }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_NAME: ${{ vars.DB_NAME }} IMAGE_URL: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com/lwitter-repo:latest run: | aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment --region eu-west-3 --output json diff --git a/app.py b/app.py index 9de0286..2d9cf78 100644 --- a/app.py +++ b/app.py @@ -8,7 +8,7 @@ import os import re from models import db, User, Article -from config import db_config, flask_secret_key # Remplacer db_credentials par db_config +from config import db_config, flask_secret_key import logging from logging.handlers import RotatingFileHandler from flask import g @@ -19,7 +19,7 @@ def create_app(): app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = f"mysql+mysqlconnector://{db_config['user']}:{db_config['password']}@{db_config['host']}/{db_config['database']}" app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False - app.config['SECRET_KEY'] = flask_secret_key # Remplacer SECRET_KEY par flask_secret_key + app.config['SECRET_KEY'] = flask_secret_key # Configurer l'upload d'images UPLOAD_FOLDER = 'static/uploads' diff --git a/config.py b/config.py index e14628f..fe95fd0 100644 --- a/config.py +++ b/config.py @@ -12,7 +12,8 @@ 'database': os.getenv('DB_NAME', 'default_db_name') } -flask_secret_key = os.getenv('FLASK_SECRET_KEY', 'default_secret_key') +flask_secret_key = os.getenv('FLASK_SECRET_KEY') +admin_password = os.getenv('ADMIN_PASSWORD') # # Debugging print statements diff --git a/initialize_db.py b/initialize_db.py index cca3d95..ad22432 100644 --- a/initialize_db.py +++ b/initialize_db.py @@ -13,7 +13,7 @@ print(f"DB_USER={os.getenv('DB_USER')}") print(f"DB_PASSWORD={os.getenv('DB_PASSWORD')}") print(f"DB_NAME={os.getenv('DB_NAME')}") -print(f"SECRET_KEY={os.getenv('SECRET_KEY')}") +print(f"FLASK_SECRET_KEY={os.getenv('FLASK_SECRET_KEY')}") print(f"ADMIN_PASSWORD={os.getenv('ADMIN_PASSWORD')}") app = create_app()