forked from iam-veeramalla/python-for-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a30ed9f
commit 4126860
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
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,17 @@ | ||
# Server Configuration File | ||
|
||
# Network Settings | ||
PORT = 8080 | ||
MAX_CONNECTIONS=600 | ||
TIMEOUT = 30 | ||
|
||
# Security Settings | ||
SSL_ENABLED = true | ||
SSL_CERT = /path/to/certificate.pem | ||
|
||
# Logging Settings | ||
LOG_LEVEL = INFO | ||
LOG_FILE = /var/log/server.log | ||
|
||
# Other Settings | ||
ENABLE_FEATURE_X = true |
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,25 @@ | ||
def update_server_config(file_path, key, value): | ||
# Read the existing content of the server configuration file | ||
with open(file_path, 'r') as file: | ||
lines = file.readlines() | ||
|
||
# Update the configuration value for the specified key | ||
with open(file_path, 'w') as file: | ||
for line in lines: | ||
# Check if the line starts with the specified key | ||
if key in line: | ||
# Update the line with the new value | ||
file.write(key + "=" + value + "\n") | ||
else: | ||
# Keep the existing line as it is | ||
file.write(line) | ||
|
||
# Path to the server configuration file | ||
server_config_file = 'server.conf' | ||
|
||
# Key and new value for updating the server configuration | ||
key_to_update = 'MAX_CONNECTIONS' | ||
new_value = '600' # New maximum connections allowed | ||
|
||
# Update the server configuration file | ||
update_server_config(server_config_file, key_to_update, new_value) |
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