-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
78 lines (71 loc) · 2.33 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from flask import Flask
import os
app = Flask(__name__)
@app.route('/')
def index():
# Fetch required environment variables
env_vars = {
'Database Password': os.environ.get('database_password', 'Not Set'),
'Database URL': os.environ.get('database_url', 'Not Set'),
'Database Username': os.environ.get('database_username', 'Not Set'),
'Background Colour': os.environ.get('colour', '#FFFFFF'),
'Hostname': os.environ.get('HOSTNAME', 'Not Set')
}
# HTML and CSS for the page layout
html_content = f'''
<html>
<head>
<style>
body {{
font-family: Arial, sans-serif;
background-color: {env_vars['Background Colour']};
color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}}
.container {{
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 500px;
width: 100%;
}}
table {{
width: 100%;
border-collapse: collapse;
}}
th, td {{
text-align: left;
padding: 8px 12px;
border-bottom: 1px solid #ddd;
}}
th {{
background-color: #f4f4f4;
}}
tr:last-child td {{
border-bottom: none;
}}
</style>
</head>
<body>
<div class="container">
<h2>Environment Variables</h2>
<table>
<tr><th>Key</th><th>Value</th></tr>
<tr><td>City</td><td>Cape Town</td></tr>
<tr><td>Database URL</td><td>{env_vars['Database URL']}</td></tr>
<tr><td>Database Username</td><td>{env_vars['Database Username']}</td></tr>
<tr><td>Database Password</td><td>{env_vars['Database Password']}</td></tr>
<tr><td>Hostname</td><td>{env_vars['Hostname']}</td></tr>
</table>
</div>
</body>
</html>
'''
return html_content
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)