summaryrefslogtreecommitdiff
path: root/waterspout_radar/_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'waterspout_radar/_config.py')
-rw-r--r--waterspout_radar/_config.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/waterspout_radar/_config.py b/waterspout_radar/_config.py
index 7712939..222f023 100644
--- a/waterspout_radar/_config.py
+++ b/waterspout_radar/_config.py
@@ -33,6 +33,11 @@ class ConfigError(Exception):
"Raised when configuration could not be loaded or was malformed."
+def effective_pathname(pathname: str = None) -> str:
+ "Pathname of the configuration file based on optional *pathname*, environment, and default."
+ return pathname or os.getenv("WATERSPOUT_RADAR_CONFIG") or "waterspout-radar.conf"
+
+
def load(pathname: str) -> Config:
"Loads configuration from a file at *pathname*. May raise ConfigError when content does not meet expectations."
config = configparser.ConfigParser(allow_no_value=True)