30 lines
569 B
Python
30 lines
569 B
Python
from flask import Blueprint, jsonify, request
|
|
|
|
from config import get_config, write_config, load_config
|
|
|
|
blueprint = Blueprint("api_config", __name__, url_prefix="/api/config")
|
|
|
|
|
|
@blueprint.get("/")
|
|
def get_global_config():
|
|
return jsonify(get_config())
|
|
|
|
|
|
@blueprint.put("/")
|
|
def modify_global_config():
|
|
return jsonify(request.json)
|
|
|
|
|
|
@blueprint.post("/write")
|
|
def write_global_config():
|
|
return jsonify({
|
|
"result": write_config()
|
|
})
|
|
|
|
|
|
@blueprint.post("/load")
|
|
def load_global_config():
|
|
return jsonify({
|
|
"result": load_config()
|
|
})
|