27 lines
552 B
Python
27 lines
552 B
Python
|
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)
|