mirror of
https://github.com/towalink/wgfrontend.git
synced 2025-04-19 08:55:11 +00:00
Change indentation and strip quotes in more controlled manner
This commit is contained in:
parent
c8dc8d1ffb
commit
94b2053585
@ -49,30 +49,30 @@ class Configuration():
|
|||||||
password = pwdtools.hash_password(users[username])
|
password = pwdtools.hash_password(users[username])
|
||||||
# Config file content
|
# Config file content
|
||||||
config_content = textwrap.dedent(f'''\
|
config_content = textwrap.dedent(f'''\
|
||||||
### Config file of the Towalink WireGuard Frontend ###
|
### Config file of the Towalink WireGuard Frontend ###
|
||||||
[general]
|
[general]
|
||||||
# The WireGuard config file to read and write
|
# The WireGuard config file to read and write
|
||||||
# wg_configfile = /etc/wireguard/wg_rw.conf
|
# wg_configfile = /etc/wireguard/wg_rw.conf
|
||||||
wg_configfile = {wg_configfile}
|
wg_configfile = {wg_configfile}
|
||||||
|
|
||||||
# The command to be executed when the WireGuard config has changed
|
# The command to be executed when the WireGuard config has changed
|
||||||
# on_change_command =
|
# on_change_command =
|
||||||
# Example: on_change_command = "sudo /etc/init.d/wgfrontend_interface restart"
|
on_change_command = "sudo --non-interactive wg-quick down {wg_configfile}; sudo --non-interactive wg-quick up {wg_configfile}"
|
||||||
|
|
||||||
# The interface the web server shall bind to
|
# The interface the web server shall bind to
|
||||||
# socket_host = 0.0.0.0
|
# socket_host = 0.0.0.0
|
||||||
socket_host = {socket_host}
|
socket_host = {socket_host}
|
||||||
|
|
||||||
# The port the web server shall bind to
|
# The port the web server shall bind to
|
||||||
# socket_port = 8080
|
# socket_port = 8080
|
||||||
socket_port = {socket_port}
|
socket_port = {socket_port}
|
||||||
|
|
||||||
# The system user to be used for the frontend
|
# The system user to be used for the frontend
|
||||||
# user = wgfrontend
|
# user = wgfrontend
|
||||||
user = {user}
|
user = {user}
|
||||||
|
|
||||||
[users]
|
[users]
|
||||||
{username} = {password}
|
{username} = {password}
|
||||||
''')
|
''')
|
||||||
# Write to file system
|
# Write to file system
|
||||||
try:
|
try:
|
||||||
@ -130,7 +130,8 @@ class Configuration():
|
|||||||
"""The command to be executed on config changes"""
|
"""The command to be executed on config changes"""
|
||||||
cmd = self.config.get('on_change_command')
|
cmd = self.config.get('on_change_command')
|
||||||
if cmd is not None:
|
if cmd is not None:
|
||||||
cmd = cmd.strip('"\'')
|
if cmd[0] in ['"', '\'']:
|
||||||
|
cmd = cmd[1:-1]
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user