fix: fixed bootstrap overwrtting .env file and improved bool handling for js use
This commit is contained in:
@@ -359,10 +359,9 @@ class SettingsBootstrap:
|
||||
value = "true" if value else "false"
|
||||
|
||||
output_lines.append(f"{key}={value}\n")
|
||||
else:
|
||||
# Variable not in schema
|
||||
# If it exists in current .env, use that value, otherwise keep template
|
||||
if key in self.existing_env:
|
||||
elif key in self.existing_env:
|
||||
output_lines.append(f"{key}={self.existing_env[key]}\n")
|
||||
else:
|
||||
output_lines.append(line)
|
||||
@@ -371,7 +370,9 @@ class SettingsBootstrap:
|
||||
output_lines.append(line)
|
||||
|
||||
# Append custom variables from existing .env that aren't in .env.example
|
||||
custom_vars = {k: v for k, v in self.existing_env.items() if k not in processed_keys}
|
||||
custom_vars = {
|
||||
k: v for k, v in self.existing_env.items() if k not in processed_keys
|
||||
}
|
||||
if custom_vars:
|
||||
output_lines.append("\n# --- CUSTOM VARIABLES ---\n")
|
||||
output_lines.append("# Variables added manually (not in .env.example)\n")
|
||||
|
||||
@@ -150,7 +150,9 @@ class TestTemplatePreservation:
|
||||
class TestSecretPreservation:
|
||||
"""Test that secrets are never overwritten."""
|
||||
|
||||
def test_preserves_existing_secrets(self, test_toml_with_all_types, test_env_example):
|
||||
def test_preserves_existing_secrets(
|
||||
self, test_toml_with_all_types, test_env_example
|
||||
):
|
||||
"""Test that existing secrets are preserved across multiple bootstraps."""
|
||||
from alfred.settings_schema import load_schema
|
||||
|
||||
|
||||
Reference in New Issue
Block a user