summaryrefslogtreecommitdiffstats
path: root/server/master.py
blob: bcb307688675b3532614a9544527a611cfa69dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import flask
from flask import request

from backends import OVHBackend
from utils import verify_token

app = flask.Flask(__name__)
app.config.from_pyfile('config.cfg')

app.backend = OVHBackend(app.config)

@app.route('/api/1/add')
@verify_token
def add():
    app.backend.add('_acme-challenge.'+request.args['record'], request.args['value'])
    return 'ok'

@app.route('/api/1/remove')
@verify_token
def remove():
    app.backend.remove('_acme-challenge.'+request.args['record'])
    return 'ok'


if __name__ == "__main__":
    app.run(debug=True)