Skip to content

Commit 84274fc

Browse files
committed
Run pre-commit 1st time
1 parent a32dbdc commit 84274fc

File tree

3 files changed

+179
-117
lines changed

3 files changed

+179
-117
lines changed

autoconf-entrypoint

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env python3
2-
import os
3-
import json
4-
import sys
5-
import netifaces
62
import ipaddress
3+
import json
4+
import os
75
import shutil
86
import stat
9-
7+
import sys
108
from itertools import product
119

10+
import netifaces
11+
1212
SUPPORTED_CERTS = {
1313
"ssl_ca_file": "client.ca.cert.pem",
1414
"ssl_cert_file": "server.cert.pem",
@@ -85,53 +85,50 @@ for interface in netifaces.interfaces():
8585
try:
8686
# Format interface IP and netmask in common CIDR notation
8787
cidr = ipaddress.ip_network(
88-
"{addr}/{netmask}".format(**address),
89-
False,
88+
"{addr}/{netmask}".format(**address), False
9089
)
9190
except ValueError:
9291
continue
9392
# Append line to pg_hba.conf, according to template
9493
for user, db in product(LAN_USERS, LAN_DATABASES):
95-
hba_conf.append(LAN_HBA_TPL.format(
96-
connection=LAN_CONNECTION,
97-
db=db,
98-
user=user,
99-
cidr=cidr,
100-
meth=LAN_AUTH_METHOD,
101-
))
94+
hba_conf.append(
95+
LAN_HBA_TPL.format(
96+
connection=LAN_CONNECTION,
97+
db=db,
98+
user=user,
99+
cidr=cidr,
100+
meth=LAN_AUTH_METHOD,
101+
)
102+
)
102103

103104
# Generate WAN auth configuration
104105
if WAN_CONNECTION != "hostssl" or ssl_conf:
105106
for user, db, cidr in product(WAN_USERS, WAN_DATABASES, WAN_CIDRS):
106-
hba_conf.append(WAN_HBA_TPL.format(
107-
connection=WAN_CONNECTION,
108-
db=db,
109-
user=user,
110-
cidr=cidr,
111-
meth=WAN_AUTH_METHOD,
112-
))
107+
hba_conf.append(
108+
WAN_HBA_TPL.format(
109+
connection=WAN_CONNECTION,
110+
db=db,
111+
user=user,
112+
cidr=cidr,
113+
meth=WAN_AUTH_METHOD,
114+
)
115+
)
113116

114117
# Write postgres configuration files
115118
with open(CONF_FILE, "w") as conf_file:
116-
conf_file.write(CONF_TPL.format(
117-
conf_folder=CONF_FOLDER,
118-
ssl_conf="\n".join(ssl_conf),
119-
extra_conf=CONF_EXTRA,
120-
))
119+
conf_file.write(
120+
CONF_TPL.format(
121+
conf_folder=CONF_FOLDER, ssl_conf="\n".join(ssl_conf), extra_conf=CONF_EXTRA
122+
)
123+
)
121124
permissions_fix(CONF_FILE)
122125
with open(HBA_FILE, "w") as conf_file:
123-
conf_file.write(HBA_TPL.format(
124-
extra_conf="\n".join(hba_conf),
125-
))
126+
conf_file.write(HBA_TPL.format(extra_conf="\n".join(hba_conf)))
126127
permissions_fix(HBA_FILE)
127128

128129
# Continue normal execution
129130
args = sys.argv[1:]
130131
if not args or args[0] == "postgres" or args[0].startswith("-"):
131132
# Need to go through parent image entrypoint, and hardcode conf file
132-
args = [
133-
"/docker-entrypoint.sh",
134-
*args,
135-
"-cconfig_file={}".format(CONF_FILE),
136-
]
133+
args = ["/docker-entrypoint.sh", *args, "-cconfig_file={}".format(CONF_FILE)]
137134
os.execvp(args[0], args)

tests/certgen

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ openssl x509 -req -in client.csr.pem -text -days 3650 \
4343
chmod u=rw,go= *.pem
4444
# Delete CSR, no longer needed
4545
rm *.csr.pem
46-

0 commit comments

Comments
 (0)