From b5c5db85c2a97c709f4c1f9a94dcbdcd9e5a6ce6 Mon Sep 17 00:00:00 2001 From: mdivecky Date: Wed, 25 Oct 2023 19:37:39 +0200 Subject: [PATCH] fix formatting, add info about black --- .githooks/pre-commit | 3 +++ README.md | 7 ++++++- n-gen.py | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100644 index 0000000..ff6ad07 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Formatting all python files with Black" +black . \ No newline at end of file diff --git a/README.md b/README.md index 6119057..955bd72 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -# Nginx configurator (patent for that name is pending...) \ No newline at end of file +# Nginx configurator (patent for that name is pending...) + + + +# Contributions +Please use `black` formatter. \ No newline at end of file diff --git a/n-gen.py b/n-gen.py index f910d40..dfe72a2 100755 --- a/n-gen.py +++ b/n-gen.py @@ -1,17 +1,18 @@ import json import pyinputplus as pyip +from jinja2 import Environment, PackageLoader, select_autoescape # Get clusters from json config with open("clusters.json") as json_file: CLUSTERS = json.load(json_file)["clusters"] # Setup Jinja2 -from jinja2 import Environment, PackageLoader, select_autoescape jin = Environment(loader=PackageLoader("n-gen"), autoescape=select_autoescape()) -# ID of next config - TBD +# ID of next config - TBD - read this from list of configs and increment! CONF_ID = 1 + def get_domains(): new_domain = True domains = []