summaryrefslogtreecommitdiffstats
path: root/server/master.py
blob: e9be8b1f6e7e8afb9f22c6ca75cfc21bc73d6742 (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
27
28
import flask
from flask import request

from backends import PowerDNSBackend
from utils import verify_token

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

app.backend = PowerDNSBackend(app.config)

@app.route('/api/1/add')
@verify_token
def add():
    name, type_ = request.args['record'].rsplit(':', 1)
    app.backend.add(name, request.args['value'], type_)
    return 'ok'

@app.route('/api/1/delete')
@verify_token
def delete():
    name, type_ = request.args['record'].rsplit(':', 1)
    app.backend.delete(name, type_)
    return 'ok'


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