From 434be2973b5f599ad7578b99778bdd789d3a8ddc Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Tue, 17 Oct 2023 18:04:06 +0200 Subject: [PATCH] Move default values to arguments --- isimip_publisher/config.py | 4 ---- isimip_publisher/main.py | 9 +++------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/isimip_publisher/config.py b/isimip_publisher/config.py index def9ff2..58d41e9 100644 --- a/isimip_publisher/config.py +++ b/isimip_publisher/config.py @@ -24,10 +24,6 @@ class Settings(BaseSettings): def setup(self, args): super().setup(args) - self.MOCK = self.MOCK.lower() in ['true', 't', '1'] - self.RESTRICTED = self.RESTRICTED.lower() in ['true', 't', '1'] - self.DATACITE_TEST_MODE = self.DATACITE_TEST_MODE.lower() in ['true', 't', '1'] - if self.ISIMIP_DATA_URL is not None: self.ISIMIP_DATA_URL = self.ISIMIP_DATA_URL.rstrip('/') diff --git a/isimip_publisher/main.py b/isimip_publisher/main.py index 1fb4310..8381816 100644 --- a/isimip_publisher/main.py +++ b/isimip_publisher/main.py @@ -62,11 +62,9 @@ def get_parser(add_path=False, add_subparsers=False): help='Archive directory') parser.add_argument('--database', dest='database', help='Database connection string, e.g. postgresql+psycopg2://username:password@host:port/dbname') - parser.add_argument('--mock', dest='mock', - default='false', + parser.add_argument('--mock', dest='mock', action='store_true', default=False, help='If set to True, no files are actually copied. Empty mock files are used instead') - parser.add_argument('--restricted', dest='restricted', - default='false', + parser.add_argument('--restricted', dest='restricted', action='store_true', default=False, help='If set to True, the files are flaged as restricted in the database.') parser.add_argument('--protocol-location', dest='protocol_locations', default='https://protocol.isimip.org https://protocol2.isimip.org', @@ -78,8 +76,7 @@ def get_parser(add_path=False, add_subparsers=False): parser.add_argument('--datacite-prefix', dest='datacite_prefix', default='10.48364', help='Prefix for DataCite') - parser.add_argument('--datacite-test-mode', dest='datacite_test_mode', - default='false', + parser.add_argument('--datacite-test-mode', dest='datacite_test_mode', action='store_true', default=False, help='If set to True, the test version of DataCite is used') parser.add_argument('--isimip-data-url', dest='isimip_data_url', default='https://data.isimip.org/',