feat: add orgconfig 1.2 migration

This commit is contained in:
swve 2024-11-26 19:05:44 +01:00
parent 6d668006f8
commit 2e618d9c5a
3 changed files with 49 additions and 16 deletions

View file

@ -67,3 +67,33 @@ def migrate_v0_to_v1(v0_config):
}
return v1_config
def migrate_to_v1_1(v1_config):
# Start by copying the existing configuration
v1_1_config = v1_config.copy()
# Update the config version
v1_1_config["config_version"] = "1.1"
# Add the new 'cloud' object at the end
v1_1_config['cloud'] = {
"plan": "free",
"custom_domain": False
}
return v1_1_config
def migrate_to_v1_2(v1_1_config):
v1_2_config = v1_1_config.copy()
v1_2_config['config_version'] = '1.2'
# Enable payments for everyone
v1_2_config['features']['payments']['enabled'] = True
# Only delete stripe_key if it exists
if 'stripe_key' in v1_2_config['features']['payments']:
del v1_2_config['features']['payments']['stripe_key']
return v1_2_config

View file

@ -1,14 +0,0 @@
def migrate_to_v1_1(v1_config):
# Start by copying the existing configuration
v1_1_config = v1_config.copy()
# Update the config version
v1_1_config["config_version"] = "1.1"
# Add the new 'cloud' object at the end
v1_1_config['cloud'] = {
"plan": "free",
"custom_domain": False
}
return v1_1_config