Updated config to have defaults for keys

Removed abstraction of data location for image build
This commit is contained in:
Vivek Santayana 2022-06-22 11:56:36 +01:00
parent ea850c9ae2
commit 9e1c9caec6
3 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,6 @@
FROM python:3.10-slim FROM python:3.10-slim
ARG DATA=./data/
ENV DATA=$DATA
WORKDIR /ref-test WORKDIR /ref-test
COPY . . COPY . .
RUN pip install --upgrade pip && pip install -r requirements.txt RUN pip install --upgrade pip && pip install -r requirements.txt

View File

@ -5,7 +5,7 @@ load_dotenv('../.env')
class Config(object): class Config(object):
APP_HOST = '0.0.0.0' APP_HOST = '0.0.0.0'
DATA = os.getenv('DATA') DATA = './data/'
DEBUG = False DEBUG = False
TESTING = False TESTING = False
SECRET_KEY = os.getenv('SECRET_KEY') SECRET_KEY = os.getenv('SECRET_KEY')

View File

@ -8,10 +8,10 @@ from cryptography.fernet import Fernet
from os import mkdir, path from os import mkdir, path
from pathlib import Path from pathlib import Path
data = Path(app.config.get('DATA'))
database_uri = app.config.get('SQLALCHEMY_DATABASE_URI') database_uri = app.config.get('SQLALCHEMY_DATABASE_URI')
with app.app_context(): with app.app_context():
data = Path(app.config.get('DATA'))
if not path.isdir(f'./{data}'): mkdir(f'./{data}') if not path.isdir(f'./{data}'): mkdir(f'./{data}')
if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions') if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions')
if not path.isfile(f'./{data}/.gitignore'): if not path.isfile(f'./{data}/.gitignore'):