Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
config.py now if it does not find the config uses the standard one. ♻️
Browse files Browse the repository at this point in the history
Makefile now works on the Windows, readthedocs no longer crashes. 📈
  • Loading branch information
cofob committed Feb 18, 2022
1 parent 9a84555 commit f267c39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ lint:

.PHONY: unit
unit:
cp config.toml.example config.toml
poetry run pytest

.PHONY: package
Expand Down
6 changes: 6 additions & 0 deletions autodonate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
format defines the allowed "Host" headers.
"""
from os import environ
from shutil import copy as copy_file
from pathlib import Path
from toml import load as toml_decode
from json import loads as json_decode
Expand Down Expand Up @@ -155,6 +156,11 @@ def __init__(self) -> None:
"config from the link: " +
"https://raw.githubusercontent.com/fire-squad/autodonate/master/config.toml", # noqa: E501
)
if (BASE_DIR / "config.toml.example").is_file():
copy_file(str(BASE_DIR / "config.toml.example"), str(self.CONFIG_PATH))
log.warning('config.toml.example found, copied to "%s" and used ' % str(self.CONFIG_PATH) + # noqa: WPS323 E501
"as config") # noqa: WPS319 WPS318
self._load()

self.inter: ConfigIntermediate = ConfigIntermediate(config=self.CONFIG)
self._check()
Expand Down

0 comments on commit f267c39

Please sign in to comment.