You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,45 @@
1
-
# Lab: Mock Python server
1
+
# Lab - Mock Python server
2
2
3
+
Anomaly uses Python for all of their server side requirements. This lab providers a containerized version of the Python server that mocks the presence of a server and simply outputs a static page with a list of key value pairs that it obtains from the container's environment.
3
4
5
+
The purpose of this application is to test the fact that the container has access to the secrets passed into it via the Kubernetes secrets mechanism. This application serves as the test Python server for Anomaly's [Terraform lab for Linode](https://github.com/anomaly/lab-tf-linode).
6
+
7
+
> This application should never be used in production.
8
+
9
+
## Configuring the environment variables
10
+
11
+
The application serves a single `root` entry point and can be configured in `src/lab_mock/__init__.py` which has a Python dictionary that resembles
12
+
13
+
```python
14
+
_ENV_LIST= [
15
+
{
16
+
"name": "PostgreSQL",
17
+
"description": "Postgres database credentials",
18
+
"vars": [
19
+
"POSTGRES_USER",
20
+
"POSTGRES_PASSWORD",
21
+
"POSTGRES_HOST",
22
+
"POSTGRES_PORT",
23
+
"POSTGRES_DB",
24
+
]
25
+
},
26
+
]
27
+
```
28
+
29
+
Each object of the array is contains:
30
+
-`name`: The name of the environment variable group
31
+
-`description`: A description of the environment variable group
32
+
-`vars`: An array of environment variable names that are part of the group
33
+
34
+
The entry point will fetch the value of each environment variable and output it as a key value pair, outputting `None` if a value is not found.
35
+
36
+
> Please ensure this list is kept in sync with the Terraform lab, unless of course you are using it for other purposes.
37
+
38
+
## Architecture
39
+
40
+
The application is built using the [Flask](https://flask.palletsprojects.com/en/1.1.x/) framework and uses Jinja2 for templating.
41
+
42
+
It uses `asgiref` to create an `ASGI` wrapper for the Flask application.
0 commit comments