Anastasia is a VERY minimalist REST API that mimics some of imgur's methods.
Method | Path | Headers | In-Path attibute | Body | Returns |
---|---|---|---|---|---|
GET | /api/3/image/{image_hash} | image_hash | None | Image file | |
DELETE | /api/3/image/{image_hash} | None | image_hash | None | None |
POST | /api/3/upload | None | None | Image file | JSON with meta |
usage: anastasia
Configuration is provided in 2 ways depending on the component you want to configure:
- API configuration: Provided via .env file named anastasia.cfg
- Uvicorn: Provided via environment variables
- folder: Path to the folder where images are stored
- contact_name: App administrator's name. The value will show up on the swagger GUI
- contact_url: App administrator's website. The value will show up on the swagger GUI
- contact_email: App administrator's email address. The value will show up on the swagger GUI
- enable_gui: If set, enables the webgui at root path.
- enable_docs: If set, enables API docs at
/api/docs/
# Image folder
folder=images/
# API frontend stuff
contact_name="Average Joe"
contact_url="http://www.example.com"
contact_email="[email protected]"
# Activate GUI
# enable_gui=true
# Activate API docs
# enable_docs=true
# Baseurl for API response (usefull in case your app is behind a load balancer)
# baseurl="https://www.example.com/"
- ANASTASIA_HOST: IP Address to bind to (default: 0.0.0.0)
- ANASTASIA_PORT: TCP port to bind to (default: 8000)
- ANASTASIA_DEBUG: If set, turns uvicorn debug on (default: disabled)
- ANASTASIA_ENV: Environment configuration file for Anastasia (see above)
In order to run Anastasia within docker you have to mount the .env file and publish the port:
docker run -it --rm -p 80:8000 -v $(pwd)/anastasia.cfg:/anastasia.cfg -v $(pwd)/images:/images anastasia