ciyidogan commited on
Commit
f5a3621
·
verified ·
1 Parent(s): 1135fec

Update config_provider.py

Browse files
Files changed (1) hide show
  1. 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
- # Atomic write using temp file
176
  with tempfile.NamedTemporaryFile(
177
  mode='w',
178
  encoding='utf-8',
179
- dir=cls._CONFIG_PATH.parent,
180
- delete=False
 
 
181
  ) as tmp_file:
182
  tmp_file.write(json_str)
183
  temp_path = Path(tmp_file.name)
184
 
185
- # Atomic rename
186
- temp_path.replace(cls._CONFIG_PATH)
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