1.6 KiB
WebVars
WebVars is a lightweight Flask application for storing and retrieving configuration variables. It supports namespacing by project and uses SQLite for persistence.
Features
- Simple API: Get and set variables via HTTP GET requests.
- Namespacing: Organize variables by namespace and project.
- Dockerized: Ready to deploy with Docker and Docker Compose.
API Usage
Set a Variable
To set a variable, make a GET request to the following pattern:
GET /<namespace>/<project>/<name>/<value>
Example:
curl http://localhost:8080/dev/backend/api_key/secret123
Get a Variable
To retrieve a variable, make a GET request to:
GET /<namespace>/<project>/<name>
Example:
curl http://localhost:8080/dev/backend/api_key
Deployment
Using Docker Compose
The easiest way to run WebVars is with Docker Compose.
-
Start the service:
docker compose up -dThe service will be available at
http://localhost:8080. -
Persistence: The
docker-compose.ymlis configured to mount a localwebvars.dbfile to/app/webvars.dbinside the container. It is recommended to create this file before starting the container to ensure it is treated as a file, not a directory.touch webvars.db docker compose up -d
Using Docker CLI
You can also build and run the container manually.
-
Build the image:
docker build -t webvars . -
Run the container:
touch webvars.db docker run -d \ -p 8080:80 \ -v $(pwd)/webvars.db:/app/webvars.db \ --name webvars \ webvars