Spaces:
Building
Building
Update config_provider.py
Browse files- config_provider.py +9 -6
config_provider.py
CHANGED
@@ -172,19 +172,22 @@ class ConfigProvider:
|
|
172 |
data = config.model_dump(mode='json') # to_jsonc_dict yerine model_dump
|
173 |
json_str = json.dumps(data, ensure_ascii=False, indent=2)
|
174 |
|
175 |
-
#
|
176 |
with tempfile.NamedTemporaryFile(
|
177 |
mode='w',
|
178 |
encoding='utf-8',
|
179 |
-
dir=
|
180 |
-
delete=False
|
|
|
|
|
181 |
) as tmp_file:
|
182 |
tmp_file.write(json_str)
|
183 |
temp_path = Path(tmp_file.name)
|
184 |
|
185 |
-
#
|
186 |
-
|
187 |
-
|
|
|
188 |
# Update cache
|
189 |
with cls._lock:
|
190 |
cls._instance = config
|
|
|
172 |
data = config.model_dump(mode='json') # to_jsonc_dict yerine model_dump
|
173 |
json_str = json.dumps(data, ensure_ascii=False, indent=2)
|
174 |
|
175 |
+
# Önce /tmp'de oluştur
|
176 |
with tempfile.NamedTemporaryFile(
|
177 |
mode='w',
|
178 |
encoding='utf-8',
|
179 |
+
dir='/tmp', # /app yerine /tmp kullan
|
180 |
+
delete=False,
|
181 |
+
prefix='flare_config_',
|
182 |
+
suffix='.jsonc'
|
183 |
) as tmp_file:
|
184 |
tmp_file.write(json_str)
|
185 |
temp_path = Path(tmp_file.name)
|
186 |
|
187 |
+
# Sonra hedef konuma taşı
|
188 |
+
import shutil
|
189 |
+
shutil.move(str(temp_path), str(cls._CONFIG_PATH))
|
190 |
+
|
191 |
# Update cache
|
192 |
with cls._lock:
|
193 |
cls._instance = config
|