wyacznie auth na read only endpointach
This commit is contained in:
parent
fa73c9ea6d
commit
e3f26f546e
4
app.py
4
app.py
@ -102,7 +102,7 @@ def update_hosts():
|
|||||||
# Endpoint /health – zwraca status usługi
|
# Endpoint /health – zwraca status usługi
|
||||||
@app.route('/health', methods=['GET'])
|
@app.route('/health', methods=['GET'])
|
||||||
def health():
|
def health():
|
||||||
require_auth()
|
#require_auth()
|
||||||
uptime = time.time() - psutil.boot_time()
|
uptime = time.time() - psutil.boot_time()
|
||||||
now = datetime.now(timezone.utc).isoformat()
|
now = datetime.now(timezone.utc).isoformat()
|
||||||
logger.info(f"/health check from {request.remote_addr}")
|
logger.info(f"/health check from {request.remote_addr}")
|
||||||
@ -111,7 +111,7 @@ def health():
|
|||||||
# Endpoint /metrics – zwraca metryki
|
# Endpoint /metrics – zwraca metryki
|
||||||
@app.route('/metrics', methods=['GET'])
|
@app.route('/metrics', methods=['GET'])
|
||||||
def metrics_endpoint():
|
def metrics_endpoint():
|
||||||
require_auth()
|
#require_auth()
|
||||||
avg_time = metrics["total_time"] / metrics["total_requests"] if metrics["total_requests"] > 0 else 0.0
|
avg_time = metrics["total_time"] / metrics["total_requests"] if metrics["total_requests"] > 0 else 0.0
|
||||||
ep_data = {}
|
ep_data = {}
|
||||||
for ep, data in metrics["endpoints"].items():
|
for ep, data in metrics["endpoints"].items():
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
Flask
|
Flask
|
||||||
Flask-SSLify
|
Flask-SSLify
|
||||||
Flask-SQLAlchemy
|
|
||||||
paramiko
|
|
||||||
croniter
|
|
||||||
tzlocal
|
tzlocal
|
||||||
gunicorn
|
gunicorn
|
||||||
psutil
|
psutil
|
||||||
|
2
ssl.txt
2
ssl.txt
@ -1,5 +1,5 @@
|
|||||||
sudo mkdir -p /opt/hosts_daemon/ssl
|
sudo mkdir -p /opt/hosts_daemon/ssl
|
||||||
sudo openssl req -x509 -nodes -days 3650-newkey rsa:2048 \
|
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
|
||||||
-keyout /opt/hosts_daemon/ssl/hosts_daemon.key \
|
-keyout /opt/hosts_daemon/ssl/hosts_daemon.key \
|
||||||
-out /opt/hosts_daemon/ssl/hosts_daemon.crt \
|
-out /opt/hosts_daemon/ssl/hosts_daemon.crt \
|
||||||
-subj "/C=PL/ST=WLKP/L=POZ/O=linuxiarz.pl/OU=hostsDaemon/CN=0.0.0.0"
|
-subj "/C=PL/ST=WLKP/L=POZ/O=linuxiarz.pl/OU=hostsDaemon/CN=0.0.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user