-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from stanfrbd/advanced-config
Advanced config close #20
- Loading branch information
Showing
10 changed files
with
193 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Ignore temporary files | ||
*.tmp | ||
*.swp | ||
|
||
# Ignore OS generated files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Ignore Python cache directories | ||
__pycache__ | ||
|
||
# Ignore Git directory | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import json | ||
import configparser | ||
|
||
# Path to the secrets file | ||
secrets_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'secrets.json') | ||
|
||
# Path to the supervisord.conf file | ||
supervisord_conf_file = os.path.join(os.path.dirname(__file__), 'supervisord.conf') | ||
|
||
# Read the secrets file | ||
with open(secrets_file, 'r') as f: | ||
secrets = json.load(f) | ||
|
||
# Read the existing supervisord.conf | ||
config = configparser.ConfigParser() | ||
config.read(supervisord_conf_file) | ||
|
||
supervisor_conf_edited = False | ||
|
||
# Update the supervisord.conf with the new parameters if they exist | ||
if 'supervisord_workers_count' in secrets: | ||
config['program:cyberbro']['command'] = config['program:cyberbro']['command'].replace( | ||
'-w ' + config['program:cyberbro']['command'].split('-w ')[1].split()[0], | ||
f"-w {secrets['supervisord_workers_count']}" | ||
) | ||
supervisor_conf_edited = True | ||
|
||
if 'supervisord_threads_count' in secrets: | ||
config['program:cyberbro']['command'] = config['program:cyberbro']['command'].replace( | ||
'-t ' + config['program:cyberbro']['command'].split('-t ')[1].split()[0], | ||
f"-t {secrets['supervisord_threads_count']}" | ||
) | ||
supervisor_conf_edited = True | ||
|
||
if supervisor_conf_edited: | ||
# Write the updated supervisord.conf | ||
with open(supervisord_conf_file, 'w') as configfile: | ||
config.write(configfile) |
Oops, something went wrong.