Migrate declarative configs to config/ dir and remove hardcoded paths
Replace all hardcoded /home/wall/vacuum-wall paths in lib/ with Path(__file__).resolve()
auto-discovery. Move config files from data/ to config/<subsystem>/config.json.
ACME now uses ACME_HOME env var and data/acme/ for cert storage. Systemd units
and sudoers use {{ USER_NAME }}, {{ PROJECT_DIR }}, {{ ACME_HOME }} Jinja2
template variables for install-time substitution. Remove sys.path.insert boot
strap from test files.
This commit is contained in:
+6
-3
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, "/home/wall/vacuum-wall")
|
||||
|
||||
from lib import nginx
|
||||
|
||||
|
||||
@@ -25,7 +22,10 @@ def temp_data_dir(tmp_path):
|
||||
original_htpasswd = nginx.HTPASSWD_FILE
|
||||
original_ssl_snippet = nginx.SSL_SNIPPET
|
||||
original_include = nginx.INCLUDE_FILE
|
||||
original_config_dir = nginx.CONFIG_DIR
|
||||
original_data_dir = nginx.DATA_DIR
|
||||
|
||||
nginx.CONFIG_DIR = tmp_path / "nginx"
|
||||
nginx.DATA_DIR = tmp_path / "nginx"
|
||||
nginx.SITES_DIR = tmp_path / "nginx" / "sites-enabled"
|
||||
nginx.CONFIG_FILE = tmp_path / "nginx" / "config.json"
|
||||
@@ -33,6 +33,7 @@ def temp_data_dir(tmp_path):
|
||||
nginx.SSL_SNIPPET = tmp_path / "ssl_snippet.conf"
|
||||
nginx.INCLUDE_FILE = tmp_path / "include.conf"
|
||||
|
||||
nginx.CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
||||
nginx.DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
nginx.SITES_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -43,6 +44,8 @@ def temp_data_dir(tmp_path):
|
||||
nginx.HTPASSWD_FILE = original_htpasswd
|
||||
nginx.SSL_SNIPPET = original_ssl_snippet
|
||||
nginx.INCLUDE_FILE = original_include
|
||||
nginx.CONFIG_DIR = original_config_dir
|
||||
nginx.DATA_DIR = original_data_dir
|
||||
|
||||
|
||||
class TestGetConfig:
|
||||
|
||||
Reference in New Issue
Block a user