From 538b8fb1a0ada717e9ee02c3497f6044504fe99b Mon Sep 17 00:00:00 2001 From: Jefferson Gomes Date: Mon, 22 Jul 2024 14:59:59 -0300 Subject: [PATCH] - general adjustments --- .github/workflows/deploy.yml | 5 ++++- backend/app.py | 8 ++++++-- backend/tests/conftest.py | 5 ++--- frontend/vue.config.js | 5 +++++ run/backend.bat | 4 ++-- 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 frontend/vue.config.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a4e8055..de22c29 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,7 +43,7 @@ jobs: JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | - source ../venv/bin/activate + source venv/bin/activate pytest --disable-warnings build-frontend: @@ -67,6 +67,9 @@ jobs: working-directory: ./frontend run: npm run build + - name: List files + run: ls -la ./frontend/dist + deploy-frontend: runs-on: ubuntu-latest needs: build-frontend diff --git a/backend/app.py b/backend/app.py index 78a551a..0888639 100644 --- a/backend/app.py +++ b/backend/app.py @@ -5,9 +5,13 @@ from flask_jwt_extended import JWTManager from log_config import setup_logging -def create_app(): +def create_app(test_config=None): app = Flask(__name__) - app.config.from_object(Config) + + if test_config: + app.config.update(test_config) + else: + app.config.from_object(Config) # Inicializa o MongoDB init_mongo(app) diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index f8ad536..228b896 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -10,10 +10,9 @@ @pytest.fixture def app(): - app = create_app() - app.config.update({ + app = create_app({ "TESTING": True, - "MONGO_URI": 'mongodb://localhost:27017/jreport' + "MONGO_URI": os.getenv('MONGO_URI', "mongodb://localhost:27017/jprogram") }) return app diff --git a/frontend/vue.config.js b/frontend/vue.config.js new file mode 100644 index 0000000..36d8020 --- /dev/null +++ b/frontend/vue.config.js @@ -0,0 +1,5 @@ +module.exports = { + outputDir : 'dist', + publicPath: process.env.NODE_ENV === 'production' ? '/jreport/' : '/' +} + \ No newline at end of file diff --git a/run/backend.bat b/run/backend.bat index 85b5112..25810e9 100644 --- a/run/backend.bat +++ b/run/backend.bat @@ -13,9 +13,10 @@ if not exist "%diretorioVerificar%venv" ( cd /d "%diretorioVerificar%" -:: call venv\Scripts\activate +python -m pip install --upgrade pip + pip install -r requirements.txt python app.py @@ -24,4 +25,3 @@ python app.py pause endlocal -pause