Skip to content

Commit 4126860

Browse files
update files for day-12
1 parent a30ed9f commit 4126860

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

Day-12/README.md

Whitespace-only changes.

Day-12/server.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Server Configuration File
2+
3+
# Network Settings
4+
PORT = 8080
5+
MAX_CONNECTIONS=600
6+
TIMEOUT = 30
7+
8+
# Security Settings
9+
SSL_ENABLED = true
10+
SSL_CERT = /path/to/certificate.pem
11+
12+
# Logging Settings
13+
LOG_LEVEL = INFO
14+
LOG_FILE = /var/log/server.log
15+
16+
# Other Settings
17+
ENABLE_FEATURE_X = true

Day-12/update_server.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
def update_server_config(file_path, key, value):
2+
# Read the existing content of the server configuration file
3+
with open(file_path, 'r') as file:
4+
lines = file.readlines()
5+
6+
# Update the configuration value for the specified key
7+
with open(file_path, 'w') as file:
8+
for line in lines:
9+
# Check if the line starts with the specified key
10+
if key in line:
11+
# Update the line with the new value
12+
file.write(key + "=" + value + "\n")
13+
else:
14+
# Keep the existing line as it is
15+
file.write(line)
16+
17+
# Path to the server configuration file
18+
server_config_file = 'server.conf'
19+
20+
# Key and new value for updating the server configuration
21+
key_to_update = 'MAX_CONNECTIONS'
22+
new_value = '600' # New maximum connections allowed
23+
24+
# Update the server configuration file
25+
update_server_config(server_config_file, key_to_update, new_value)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
- Practice exercises and examples:
6969
- Example: Managing a dictionary of server configurations and optimizing retrieval.
7070

71-
## Day 12: Python Libraries for DevOps (Part 1)
71+
## Day 12: Python Tasks for DevOps (Part 1) - File Operations
7272
- Introduction to File Operations and Boto3.
7373
- Automating File operations.
7474
- Practice exercises and examples:
7575
- Example: Update a server resources in the server.conf file up on external notification.
7676

77-
## Day 13: Python Libraries for DevOps (Part 2)
77+
## Day 13: Python Tasks for DevOps (Part 2)
7878
- Using Fabric for remote task automation.
7979
- AWS automation with Boto3.
8080
- Managing EC2 instances, S3 buckets, and more.

0 commit comments

Comments
 (0)