diff --git a/Dockerfile b/Dockerfile index ff8586f..a0c34e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,5 +10,5 @@ RUN pip3 install -U pip ENV PATH="/home/devpisrv/.local/bin:${PATH}" RUN pip install -U -r /tmp/requirements.txt COPY src/devpisrv.py /usr/local/bin/ -ENTRYPOINT ["devpisrv.py"] +ENTRYPOINT ["devpisrv.py", "--overwrite-config"] diff --git a/src/devpisrv.py b/src/devpisrv.py index 17ccad1..4c65b93 100755 --- a/src/devpisrv.py +++ b/src/devpisrv.py @@ -13,9 +13,15 @@ arg_parser.add_argument( '-d', '--data-dir', type=str, - default = '/var/local/devpisrv', - help = 'Path to the data directory' + default='/var/local/devpisrv', + help='Path to the data directory' ) +arg_parser.add_argument( + '-w', + '--overwrite-config', + action='store_true', + default=False, + help='Overwrite the config file if exists') args = arg_parser.parse_args() server_dir = os.path.join(args.data_dir, "server") @@ -29,7 +35,7 @@ for subdir_path in [server_dir, config_dir]: if not os.path.exists(subdir_path): os.mkdir(subdir_path, mode=0o770) -if not os.path.exists(config_file): +if not os.path.exists(config_file) or args.overwrite_config: env_config_values = dotenv_values(env_file) if os.path.isfile(env_file) else { } config_data = {