Spaces:
Sleeping
Sleeping
Delete secure_config.py
Browse files- secure_config.py +0 -29
secure_config.py
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from dotenv import load_dotenv
|
3 |
-
|
4 |
-
# .env dosyasını yükle
|
5 |
-
load_dotenv()
|
6 |
-
|
7 |
-
# Kritik değerler
|
8 |
-
HF_TOKEN = os.environ.get("HF_TOKEN")
|
9 |
-
ENCRYPTION_KEY = os.environ.get("ENCRYPTION_KEY")
|
10 |
-
|
11 |
-
# Değerler yoksa uyarı
|
12 |
-
if not HF_TOKEN:
|
13 |
-
import warnings
|
14 |
-
warnings.warn("HF_TOKEN bulunamadı! Diyarizasyon çalışmayacak.", UserWarning)
|
15 |
-
|
16 |
-
# SecureStorage için fallback mekanizması
|
17 |
-
def get_encryption_key():
|
18 |
-
key = os.environ.get("ENCRYPTION_KEY")
|
19 |
-
if not key:
|
20 |
-
# Sadece geliştirme ortamında ve key yoksa oluştur
|
21 |
-
if os.environ.get("ENVIRONMENT") == "development":
|
22 |
-
from cryptography.fernet import Fernet
|
23 |
-
key = Fernet.generate_key().decode()
|
24 |
-
# Sadece log dosyasına yaz, konsolda gösterme
|
25 |
-
import logging
|
26 |
-
logging.warning(f"YENİ ANAHTAR OLUŞTURULDU: {key}")
|
27 |
-
else:
|
28 |
-
raise ValueError("Üretim ortamında ENCRYPTION_KEY eksik!")
|
29 |
-
return key
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|