diff --git a/.env-template b/.env-template new file mode 100644 index 0000000..f00c616 --- /dev/null +++ b/.env-template @@ -0,0 +1 @@ +OSM_ATM_MATCHER_CACHE_FOLDER=/media/mateusz/OSM_cache/ATP_matcher_cache diff --git a/.gitignore b/.gitignore index 39c92be..4d76103 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ nominatim_cache url_check_cache distance_distribution_charts + +# there will be env file template +.env diff --git a/0_config.py b/0_config.py index ed3adf9..20e1060 100644 --- a/0_config.py +++ b/0_config.py @@ -1,6 +1,10 @@ import datetime import osm_bot_abstraction_layer.tag_knowledge as tag_knowledge +import dotenv +import os +dotenv.load_dotenv() # make environment variables specified in .env available + # see https://github.com/theskumar/python-dotenv def is_nonlocal_phone_worth_mentioning(atp_code): if datetime.datetime.now() < datetime.datetime(2024, 8, 27): @@ -95,7 +99,7 @@ def consider_reporting_broken_spider(atp_code): return def cache_folder(): - return "/media/mateusz/OSM_cache/ATP_matcher_cache/" + return os.getenv("OSM_ATM_MATCHER_CACHE_FOLDER") + "/" def atp_cache_folder(): diff --git a/README.MD b/README.MD index ab952b1..bd13c7a 100644 --- a/README.MD +++ b/README.MD @@ -36,6 +36,12 @@ pip install --requirement requirements-dev.txt # install dependencies pre-commit install # install pre-commit checks, see https://pre-commit.com/ ``` +and then customize config files - you need at least to specify where cache will be +``` +cp .env-template .env # copy config file template for customization +codium .env # open with whatever text editor you are using, you do not need this specific one +``` + ## Run tests Tests are run by pre-commit before each commit. diff --git a/requirements.txt b/requirements.txt index d2214b4..f892c60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ geopy diskcache phonenumbers plotly +python-dotenv