docker
This commit is contained in:
@@ -5,7 +5,7 @@ FROM python:3.11-alpine
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# JSON dosyasını ve Python sunucusu betiğini kopyala
|
# JSON dosyasını ve Python sunucusu betiğini kopyala
|
||||||
COPY config.json server.py ./
|
COPY islamic.json server.py ./
|
||||||
|
|
||||||
# 80 portunu dışarı aç (Coolify varsayılanı)
|
# 80 portunu dışarı aç (Coolify varsayılanı)
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
|||||||
|
|
||||||
class RequestHandler(BaseHTTPRequestHandler):
|
class RequestHandler(BaseHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
# Kök dizin (/) veya /config.json isteklerinde JSON dönüyoruz
|
# Kök dizin (/) veya /islamic.json isteklerinde JSON dönüyoruz
|
||||||
if self.path in ['/', '/config.json', '/api']:
|
if self.path in ['/', '/islamic.json', '/api']:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-Type', 'application/json; charset=utf-8')
|
self.send_header('Content-Type', 'application/json; charset=utf-8')
|
||||||
# CORS ayarları (Uygulamalardan sorunsuz erişim için)
|
# CORS ayarları (Uygulamalardan sorunsuz erişim için)
|
||||||
@@ -15,7 +15,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open('config.json', 'r', encoding='utf-8') as f:
|
with open('islamic.json', 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
self.wfile.write(content.encode('utf-8'))
|
self.wfile.write(content.encode('utf-8'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user