simple look

This commit is contained in:
Para Dox
2025-04-27 22:30:57 +07:00
parent cbfe770a1a
commit 5c63c62859
3 changed files with 41 additions and 0 deletions

7
logging-proxy.yml Normal file
View File

@@ -0,0 +1,7 @@
services:
logging-proxy:
build: .
ports:
- "8545:8545"
environment:
TARGET_URL: "${LOGGING_PROXY_TARGET_URL}"

11
logging-proxy/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM python:3.12-slim
WORKDIR /app
RUN pip install flask requests
COPY proxy.py .
EXPOSE 8545
CMD ["python", "proxy.py"]

23
logging-proxy/proxy.py Normal file
View File

@@ -0,0 +1,23 @@
from flask import Flask, request, jsonify
import requests
import sys
import os
app = Flask(__name__)
# Target JSON-RPC server, e.g., an Ethereum node
TARGET_URL = os.getenv('TARGET_URL', 'http://host.docker.internal:8545')
@app.route('/', methods=['POST'])
def proxy():
incoming = request.get_json()
print(f"==> Request:\n{incoming}", file=sys.stdout, flush=True)
response = requests.post(TARGET_URL, json=incoming)
outgoing = response.json()
print(f"<== Response:\n{outgoing}", file=sys.stdout, flush=True)
return jsonify(outgoing)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8545)