Skip to content

anime-skip/remote-config

Repository files navigation

remote-config

This is a lightweight and simple remote config server with a UI for management backed by AWS S3.

The backend API (Go) serves a frontend (Vue) and HTTP endpoints.

demo

I wrote this because I don't want to pay for another service and Firebase doesn't work all the time in web extensions :/

Get Started

  1. Create S3 Bucket
  2. Build the docker image
  3. Deploy the docker image

That's it!

1. Create S3 Bucket

You can create the S3 bucket however you like. Or you can use an existing one.

See AWS's docs if you've never done this before: https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html

2. Build the docker image

Eventually, I'm going to publish this image to docker hub. Until then, build and tag the image yourself:

git clone [email protected]:anime-skip/remote-config.git
docker build . -t my-remove-config

3. Deploy the docker image

You will have to self host this docker image. AWS, Heroku, GoogleCloud, anywhere that supports deploying docker images will work.

Make sure you provide all the environment variables however your hosting provider allows.


Docs

Environment Variables

Variable Required Default Example Description
PORT --- 80, 8080 The port to run the application on
AUTH_TOKEN --- password The token used to authenticate changes to the remove config. Config is viewable by everyone, but only writable if you know the token
AWS_REGION --- us-east-1 The AWS region your bucket is in
AWS_ACCESS_KEY_ID --- See AWS Docs
AWS_SECRET_ACCESS_KEY --- See AWS Docs
S3_BUCKET --- remote-config The name of the bucket used as storage
S3_FILE_PATH --- dev.json, prod.json, path/to/my-file.json The path to the file in your bucket. The file can be named whatever, as long as it ends with .json, and the path can excluded or point to any subdirectory. Missing directories will be created

API Docs

HTTPie is used for example calls because it's easier to read and understand compared to curl.

http -b prints just the response body.

GET /api/apps

List all the apps you have created remote config for.

$ http -b "remote-config.anime-skip.com/api/apps"
[
    "Anime Skip Player",
    "anime-skip.com"
]

GET /api/config/{app}

Get the current config for an app.

$ http -b "remote-config.anime-skip.com/api/config/anime-skip.com"
{
    "array": [
        1,
        null,
        "string"
    ],
    "number": 69,
    "object": {
        "key": "value"
    },
    "optional": null,
    "string": "test"
}

PUT /api/config/{app}

Create or update the config for a given app name, returning the updated config.

Requires Authorization: Bearer <token> header

$ http -b -A bearer -a "<token>" PUT "remote-config.anime-skip.com/api/config/example" key=value
{
    "key": "value"
}

DELETE /api/config/{app}

Delete an app's config, returning the deleted config

Requires Authorization: Bearer <token> header

$ http -b -A bearer -a "<token>" DELETE "remote-config.anime-skip.com/api/config/example"
{
    "key": "value"
}

Other Tools