add dockerfile and gitea workflow
This commit is contained in:
68
README.md
68
README.md
@@ -0,0 +1,68 @@
|
||||
# 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:**
|
||||
```bash
|
||||
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:**
|
||||
```bash
|
||||
curl http://localhost:8080/dev/backend/api_key
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
### Using Docker Compose
|
||||
|
||||
The easiest way to run WebVars is with Docker Compose.
|
||||
|
||||
1. **Start the service:**
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
The service will be available at `http://localhost:8080`.
|
||||
|
||||
2. **Persistence:**
|
||||
The `docker-compose.yml` is configured to mount a local `webvars.db` file to `/app/webvars.db` inside the container. It is recommended to create this file before starting the container to ensure it is treated as a file, not a directory.
|
||||
|
||||
```bash
|
||||
touch webvars.db
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### Using Docker CLI
|
||||
|
||||
You can also build and run the container manually.
|
||||
|
||||
1. **Build the image:**
|
||||
```bash
|
||||
docker build -t webvars .
|
||||
```
|
||||
|
||||
2. **Run the container:**
|
||||
```bash
|
||||
touch webvars.db
|
||||
docker run -d \
|
||||
-p 8080:80 \
|
||||
-v $(pwd)/webvars.db:/app/webvars.db \
|
||||
--name webvars \
|
||||
webvars
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user