fix formatting, add info about black

This commit is contained in:
Matěj Divecký 2023-10-25 19:37:39 +02:00
parent 235c9fdb2a
commit b5c5db85c2
3 changed files with 12 additions and 3 deletions

3
.githooks/pre-commit Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
echo "Formatting all python files with Black"
black .

View file

@ -1 +1,6 @@
# Nginx configurator (patent for that name is pending...) # Nginx configurator (patent for that name is pending...)
# Contributions
Please use `black` formatter.

View file

@ -1,17 +1,18 @@
import json import json
import pyinputplus as pyip import pyinputplus as pyip
from jinja2 import Environment, PackageLoader, select_autoescape
# Get clusters from json config # Get clusters from json config
with open("clusters.json") as json_file: with open("clusters.json") as json_file:
CLUSTERS = json.load(json_file)["clusters"] CLUSTERS = json.load(json_file)["clusters"]
# Setup Jinja2 # Setup Jinja2
from jinja2 import Environment, PackageLoader, select_autoescape
jin = Environment(loader=PackageLoader("n-gen"), autoescape=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 CONF_ID = 1
def get_domains(): def get_domains():
new_domain = True new_domain = True
domains = [] domains = []