diff --git a/selfprivacy_api/graphql/queries/providers.py b/selfprivacy_api/graphql/queries/providers.py index 6d0381e..eba8df9 100644 --- a/selfprivacy_api/graphql/queries/providers.py +++ b/selfprivacy_api/graphql/queries/providers.py @@ -11,3 +11,9 @@ class DnsProvider(Enum): @strawberry.enum class ServerProvider(Enum): HETZNER = "HETZNER" + DIGITALOCEAN = "DIGITALOCEAN" + + +@strawberry.enum +class BackupProvider(Enum): + BACKBLAZE = "BACKBLAZE" diff --git a/selfprivacy_api/graphql/queries/system.py b/selfprivacy_api/graphql/queries/system.py index 0e2a7ec..112fa8c 100644 --- a/selfprivacy_api/graphql/queries/system.py +++ b/selfprivacy_api/graphql/queries/system.py @@ -44,7 +44,7 @@ def get_system_domain_info() -> SystemDomainInfo: return SystemDomainInfo( domain=user_data["domain"], hostname=user_data["hostname"], - provider=DnsProvider.CLOUDFLARE, + provider=user_data["dns"]["provider"], ) @@ -133,7 +133,11 @@ class SystemProviderInfo: def get_system_provider_info() -> SystemProviderInfo: """Get system provider info""" - return SystemProviderInfo(provider=ServerProvider.HETZNER, id="UNKNOWN") + with ReadUserData() as user_data: + return SystemProviderInfo( + provider=user_data["server"]["provider"], + id="UNKNOWN" + ) @strawberry.type diff --git a/selfprivacy_api/migrations/__init__.py b/selfprivacy_api/migrations/__init__.py index b051f04..7385548 100644 --- a/selfprivacy_api/migrations/__init__.py +++ b/selfprivacy_api/migrations/__init__.py @@ -18,6 +18,7 @@ from selfprivacy_api.migrations.migrate_to_selfprivacy_channel import ( MigrateToSelfprivacyChannel, ) from selfprivacy_api.migrations.mount_volume import MountVolume +from selfprivacy_api.migrations.providers import CreateProviderFields migrations = [ FixNixosConfigBranch(), @@ -25,6 +26,7 @@ migrations = [ MigrateToSelfprivacyChannel(), MountVolume(), CheckForFailedBindsMigration(), + CreateProviderFields(), ] diff --git a/selfprivacy_api/migrations/providers.py b/selfprivacy_api/migrations/providers.py new file mode 100644 index 0000000..2cd5d5e --- /dev/null +++ b/selfprivacy_api/migrations/providers.py @@ -0,0 +1,43 @@ +from selfprivacy_api.migrations.migration import Migration +from selfprivacy_api.utils import ReadUserData, WriteUserData + + +class CreateProviderFields(Migration): + """Unhardcode providers""" + + def get_migration_name(self): + return "create_provider_fields" + + def get_migration_description(self): + return "Add DNS, backup and server provider fields to enable user to choose between different clouds and to make the deployment adapt to these preferences." + + def is_migration_needed(self): + try: + with ReadUserData() as userdata: + return "dns" not in userdata + except Exception as e: + print(e) + return False + + def migrate(self): + # Write info about providers to userdata.json + try: + with WriteUserData() as userdata: + userdata["dns"] = { + "provider": "CLOUDFLARE", + "apiKey": userdata["cloudflare"]["apiKey"], + } + userdata["server"] = { + "provider": "HETZNER", + } + userdata["backup"] = { + "provider": "BACKBLAZE", + "accountId": userdata["backblaze"]["accountId"], + "accountKey": userdata["backblaze"]["accountKey"], + "bucket": userdata["backblaze"]["bucket"], + } + + print("Done") + except Exception as e: + print(e) + print("Error migrating provider fields") diff --git a/selfprivacy_api/rest/services.py b/selfprivacy_api/rest/services.py index c9d5ff9..ca2bc9b 100644 --- a/selfprivacy_api/rest/services.py +++ b/selfprivacy_api/rest/services.py @@ -257,24 +257,25 @@ async def restore_restic_backup(backup: BackupRestoreInput): raise HTTPException(status_code=404, detail="Backup not found") -class BackblazeConfigInput(BaseModel): +class BackupConfigInput(BaseModel): accountId: str accountKey: str bucket: str @router.put("/restic/backblaze/config") -async def set_backblaze_config(backblaze_config: BackblazeConfigInput): +async def set_backblaze_config(backup_config: BackupConfigInput): with WriteUserData() as data: - if "backblaze" not in data: - data["backblaze"] = {} - data["backblaze"]["accountId"] = backblaze_config.accountId - data["backblaze"]["accountKey"] = backblaze_config.accountKey - data["backblaze"]["bucket"] = backblaze_config.bucket + if "backup" not in data: + data["backup"] = {} + data["backup"]["provider"] = "BACKBLAZE" + data["backup"]["accountId"] = backup_config.accountId + data["backup"]["accountKey"] = backup_config.accountKey + data["backup"]["bucket"] = backup_config.bucket restic_tasks.update_keys_from_userdata() - return "New Backblaze settings saved" + return "New backup settings saved" @router.post("/ssh/enable") diff --git a/tests/test_block_device_utils/no_devices.json b/tests/test_block_device_utils/no_devices.json index 97300ca..c395b21 100644 --- a/tests/test_block_device_utils/no_devices.json +++ b/tests/test_block_device_utils/no_devices.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -49,6 +41,19 @@ "sshKeys": [ "ssh-rsa KEY test@pc" ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + }, "volumes": [ ] } diff --git a/tests/test_block_device_utils/only_root.json b/tests/test_block_device_utils/only_root.json index 0f8ec0d..1026ed0 100644 --- a/tests/test_block_device_utils/only_root.json +++ b/tests/test_block_device_utils/only_root.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -55,5 +47,18 @@ "mountPoint": "/volumes/sda1", "filesystem": "ext4" } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } diff --git a/tests/test_block_device_utils/undefined.json b/tests/test_block_device_utils/undefined.json index eb660cc..f5edda8 100644 --- a/tests/test_block_device_utils/undefined.json +++ b/tests/test_block_device_utils/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } diff --git a/tests/test_graphql/test_ssh/some_users.json b/tests/test_graphql/test_ssh/some_users.json index 569253a..c02d216 100644 --- a/tests/test_graphql/test_ssh/some_users.json +++ b/tests/test_graphql/test_ssh/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -67,5 +59,18 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_system/no_values.json b/tests/test_graphql/test_system/no_values.json index 59e5e71..779691f 100644 --- a/tests/test_graphql/test_system/no_values.json +++ b/tests/test_graphql/test_system/no_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -46,5 +38,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_system/turned_off.json b/tests/test_graphql/test_system/turned_off.json index f451683..5fc287c 100644 --- a/tests/test_graphql/test_system/turned_off.json +++ b/tests/test_graphql/test_system/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_system/turned_on.json b/tests/test_graphql/test_system/turned_on.json index 821875b..c6b758b 100644 --- a/tests/test_graphql/test_system/turned_on.json +++ b/tests/test_graphql/test_system/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -51,5 +43,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } diff --git a/tests/test_graphql/test_system/undefined.json b/tests/test_graphql/test_system/undefined.json index b67b296..2e31fea 100644 --- a/tests/test_graphql/test_system/undefined.json +++ b/tests/test_graphql/test_system/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -43,5 +35,18 @@ }, "sshKeys": [ "ssh-rsa KEY test@pc" - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_users/no_users.json b/tests/test_graphql/test_users/no_users.json index e5efe86..a40fb88 100644 --- a/tests/test_graphql/test_users/no_users.json +++ b/tests/test_graphql/test_users/no_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -50,5 +42,18 @@ "ssh-rsa KEY test@pc" ], "users": [ - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_users/one_user.json b/tests/test_graphql/test_users/one_user.json index 5df2108..7e1cced 100644 --- a/tests/test_graphql/test_users/one_user.json +++ b/tests/test_graphql/test_users/one_user.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -57,5 +49,18 @@ "ssh-rsa KEY user1@pc" ] } - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_users/some_users.json b/tests/test_graphql/test_users/some_users.json index 569253a..c02d216 100644 --- a/tests/test_graphql/test_users/some_users.json +++ b/tests/test_graphql/test_users/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -67,5 +59,18 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_graphql/test_users/undefined.json b/tests/test_graphql/test_users/undefined.json index 7b2cf8b..ae9cd9e 100644 --- a/tests/test_graphql/test_users/undefined.json +++ b/tests/test_graphql/test_users/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } +} diff --git a/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json b/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json index 05e04c1..1a95e85 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json @@ -1,18 +1,10 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false }, "bitwarden": { }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -47,5 +39,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json b/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json index 7b2cf8b..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json b/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json index 337e47f..42999d8 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_bitwarden/undefined.json b/tests/test_rest_endpoints/services/test_bitwarden/undefined.json index 625422b..ee288c2 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/undefined.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/undefined.json @@ -1,16 +1,8 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -45,5 +37,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json b/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json index 07b0e78..f9fb878 100644 --- a/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -47,5 +39,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_gitea/turned_off.json b/tests/test_rest_endpoints/services/test_gitea/turned_off.json index 7b2cf8b..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_gitea/turned_off.json +++ b/tests/test_rest_endpoints/services/test_gitea/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_gitea/turned_on.json b/tests/test_rest_endpoints/services/test_gitea/turned_on.json index acb98ce..f9a1eaf 100644 --- a/tests/test_rest_endpoints/services/test_gitea/turned_on.json +++ b/tests/test_rest_endpoints/services/test_gitea/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_gitea/undefined.json b/tests/test_rest_endpoints/services/test_gitea/undefined.json index f689b2e..a50a070 100644 --- a/tests/test_rest_endpoints/services/test_gitea/undefined.json +++ b/tests/test_rest_endpoints/services/test_gitea/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -45,5 +37,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json b/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json index 68127f0..19f1f2d 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -47,5 +39,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json b/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json index 375e70f..b80ad9e 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json b/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json index 7b2cf8b..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_nextcloud/undefined.json b/tests/test_rest_endpoints/services/test_nextcloud/undefined.json index fb02c69..46c09f3 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/undefined.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/undefined.json @@ -1,16 +1,8 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -40,5 +32,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json b/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json index 88d804d..e080110 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -47,5 +39,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ocserv/turned_off.json b/tests/test_rest_endpoints/services/test_ocserv/turned_off.json index 6220561..1c08123 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/turned_off.json +++ b/tests/test_rest_endpoints/services/test_ocserv/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ocserv/turned_on.json b/tests/test_rest_endpoints/services/test_ocserv/turned_on.json index 375e70f..b80ad9e 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/turned_on.json +++ b/tests/test_rest_endpoints/services/test_ocserv/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ocserv/undefined.json b/tests/test_rest_endpoints/services/test_ocserv/undefined.json index f7e21bf..12eb73a 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/undefined.json +++ b/tests/test_rest_endpoints/services/test_ocserv/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -45,5 +37,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json b/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json index 20ab960..0903875 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -47,5 +39,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_pleroma/turned_off.json b/tests/test_rest_endpoints/services/test_pleroma/turned_off.json index b6d5fd6..813c01f 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/turned_off.json +++ b/tests/test_rest_endpoints/services/test_pleroma/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_pleroma/turned_on.json b/tests/test_rest_endpoints/services/test_pleroma/turned_on.json index 6220561..1c08123 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/turned_on.json +++ b/tests/test_rest_endpoints/services/test_pleroma/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_pleroma/undefined.json b/tests/test_rest_endpoints/services/test_pleroma/undefined.json index b909a95..77d8ad2 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/undefined.json +++ b/tests/test_rest_endpoints/services/test_pleroma/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -45,5 +37,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_restic.py b/tests/test_rest_endpoints/services/test_restic.py index 9502be5..844ff34 100644 --- a/tests/test_rest_endpoints/services/test_restic.py +++ b/tests/test_rest_endpoints/services/test_restic.py @@ -161,7 +161,7 @@ def mock_restic_tasks(mocker): @pytest.fixture def undefined_settings(mocker, datadir): mocker.patch("selfprivacy_api.utils.USERDATA_FILE", new=datadir / "undefined.json") - assert "backblaze" not in read_json(datadir / "undefined.json") + assert "backup" not in read_json(datadir / "undefined.json") return datadir @@ -170,20 +170,22 @@ def some_settings(mocker, datadir): mocker.patch( "selfprivacy_api.utils.USERDATA_FILE", new=datadir / "some_values.json" ) - assert "backblaze" in read_json(datadir / "some_values.json") - assert read_json(datadir / "some_values.json")["backblaze"]["accountId"] == "ID" - assert read_json(datadir / "some_values.json")["backblaze"]["accountKey"] == "KEY" - assert read_json(datadir / "some_values.json")["backblaze"]["bucket"] == "BUCKET" + assert "backup" in read_json(datadir / "some_values.json") + assert read_json(datadir / "some_values.json")["backup"]["provider"] == "BACKBLAZE" + assert read_json(datadir / "some_values.json")["backup"]["accountId"] == "ID" + assert read_json(datadir / "some_values.json")["backup"]["accountKey"] == "KEY" + assert read_json(datadir / "some_values.json")["backup"]["bucket"] == "BUCKET" return datadir @pytest.fixture def no_values(mocker, datadir): mocker.patch("selfprivacy_api.utils.USERDATA_FILE", new=datadir / "no_values.json") - assert "backblaze" in read_json(datadir / "no_values.json") - assert "accountId" not in read_json(datadir / "no_values.json")["backblaze"] - assert "accountKey" not in read_json(datadir / "no_values.json")["backblaze"] - assert "bucket" not in read_json(datadir / "no_values.json")["backblaze"] + assert "backup" in read_json(datadir / "no_values.json") + assert "provider" not in read_json(datadir / "no_values.json")["backup"] + assert "accountId" not in read_json(datadir / "no_values.json")["backup"] + assert "accountKey" not in read_json(datadir / "no_values.json")["backup"] + assert "bucket" not in read_json(datadir / "no_values.json")["backup"] return datadir @@ -462,7 +464,8 @@ def test_set_backblaze_config( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(some_settings / "some_values.json")["backblaze"] == { + assert read_json(some_settings / "some_values.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", @@ -478,7 +481,8 @@ def test_set_backblaze_config_on_undefined( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(undefined_settings / "undefined.json")["backblaze"] == { + assert read_json(undefined_settings / "undefined.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", @@ -494,7 +498,8 @@ def test_set_backblaze_config_on_no_values( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(no_values / "no_values.json")["backblaze"] == { + assert read_json(no_values / "no_values.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", diff --git a/tests/test_rest_endpoints/services/test_restic/no_values.json b/tests/test_rest_endpoints/services/test_restic/no_values.json index c1ef7a0..3b4a2f5 100644 --- a/tests/test_rest_endpoints/services/test_restic/no_values.json +++ b/tests/test_rest_endpoints/services/test_restic/no_values.json @@ -1,6 +1,4 @@ { - "backblaze": { - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -8,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -64,5 +59,14 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_restic/some_values.json b/tests/test_rest_endpoints/services/test_restic/some_values.json index a7dbf39..c003d10 100644 --- a/tests/test_rest_endpoints/services/test_restic/some_values.json +++ b/tests/test_rest_endpoints/services/test_restic/some_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "BUCKET" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -67,5 +59,18 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] -} \ No newline at end of file + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "BUCKET" + } +} diff --git a/tests/test_rest_endpoints/services/test_restic/undefined.json b/tests/test_rest_endpoints/services/test_restic/undefined.json index 59e42a0..5bd1220 100644 --- a/tests/test_rest_endpoints/services/test_restic/undefined.json +++ b/tests/test_rest_endpoints/services/test_restic/undefined.json @@ -6,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -62,5 +59,12 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/all_off.json b/tests/test_rest_endpoints/services/test_ssh/all_off.json index e1b8510..051d364 100644 --- a/tests/test_rest_endpoints/services/test_ssh/all_off.json +++ b/tests/test_rest_endpoints/services/test_ssh/all_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json b/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json index 7b2cf8b..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json +++ b/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/some_users.json b/tests/test_rest_endpoints/services/test_ssh/some_users.json index 569253a..df6380a 100644 --- a/tests/test_rest_endpoints/services/test_ssh/some_users.json +++ b/tests/test_rest_endpoints/services/test_ssh/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -67,5 +59,18 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/turned_off.json b/tests/test_rest_endpoints/services/test_ssh/turned_off.json index b09395b..3856c80 100644 --- a/tests/test_rest_endpoints/services/test_ssh/turned_off.json +++ b/tests/test_rest_endpoints/services/test_ssh/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -42,5 +34,18 @@ "enable": true, "allowReboot": true }, - "timezone": "Europe/Moscow" + "timezone": "Europe/Moscow", + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/turned_on.json b/tests/test_rest_endpoints/services/test_ssh/turned_on.json index 44b28ce..e60c57f 100644 --- a/tests/test_rest_endpoints/services/test_ssh/turned_on.json +++ b/tests/test_rest_endpoints/services/test_ssh/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -42,5 +34,18 @@ "enable": true, "allowReboot": true }, - "timezone": "Europe/Moscow" + "timezone": "Europe/Moscow", + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/undefined.json b/tests/test_rest_endpoints/services/test_ssh/undefined.json index a214cc3..7c9af37 100644 --- a/tests/test_rest_endpoints/services/test_ssh/undefined.json +++ b/tests/test_rest_endpoints/services/test_ssh/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -38,5 +30,18 @@ "enable": true, "allowReboot": true }, - "timezone": "Europe/Moscow" + "timezone": "Europe/Moscow", + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/undefined_values.json b/tests/test_rest_endpoints/services/test_ssh/undefined_values.json index 235a220..b7b03d3 100644 --- a/tests/test_rest_endpoints/services/test_ssh/undefined_values.json +++ b/tests/test_rest_endpoints/services/test_ssh/undefined_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -42,5 +34,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_system/no_values.json b/tests/test_rest_endpoints/test_system/no_values.json index 59e5e71..5c1431e 100644 --- a/tests/test_rest_endpoints/test_system/no_values.json +++ b/tests/test_rest_endpoints/test_system/no_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -46,5 +38,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_system/turned_off.json b/tests/test_rest_endpoints/test_system/turned_off.json index f451683..2336f36 100644 --- a/tests/test_rest_endpoints/test_system/turned_off.json +++ b/tests/test_rest_endpoints/test_system/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_system/turned_on.json b/tests/test_rest_endpoints/test_system/turned_on.json index 337e47f..42999d8 100644 --- a/tests/test_rest_endpoints/test_system/turned_on.json +++ b/tests/test_rest_endpoints/test_system/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_system/undefined.json b/tests/test_rest_endpoints/test_system/undefined.json index b67b296..6b9f3fd 100644 --- a/tests/test_rest_endpoints/test_system/undefined.json +++ b/tests/test_rest_endpoints/test_system/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": true }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -43,5 +35,18 @@ }, "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_users/no_users.json b/tests/test_rest_endpoints/test_users/no_users.json index e5efe86..5929a79 100644 --- a/tests/test_rest_endpoints/test_users/no_users.json +++ b/tests/test_rest_endpoints/test_users/no_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -50,5 +42,18 @@ "ssh-rsa KEY test@pc" ], "users": [ - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_users/one_user.json b/tests/test_rest_endpoints/test_users/one_user.json index 5df2108..6c553bc 100644 --- a/tests/test_rest_endpoints/test_users/one_user.json +++ b/tests/test_rest_endpoints/test_users/one_user.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -57,5 +49,18 @@ "ssh-rsa KEY user1@pc" ] } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_users/some_users.json b/tests/test_rest_endpoints/test_users/some_users.json index 569253a..df6380a 100644 --- a/tests/test_rest_endpoints/test_users/some_users.json +++ b/tests/test_rest_endpoints/test_users/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -67,5 +59,18 @@ "username": "user3", "hashedPassword": "HASHED_PASSWORD_3" } - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/test_users/undefined.json b/tests/test_rest_endpoints/test_users/undefined.json index 7b2cf8b..c1691ea 100644 --- a/tests/test_rest_endpoints/test_users/undefined.json +++ b/tests/test_rest_endpoints/test_users/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -11,9 +6,6 @@ "bitwarden": { "enable": false }, - "cloudflare": { - "apiKey": "TOKEN" - }, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -48,5 +40,18 @@ "timezone": "Europe/Moscow", "sshKeys": [ "ssh-rsa KEY test@pc" - ] + ], + "dns": { + "provider": "CLOUDFLARE", + "apiKey": "TOKEN" + }, + "server": { + "provider": "HETZNER" + }, + "backup": { + "provider": "BACKBLAZE", + "accountId": "ID", + "accountKey": "KEY", + "bucket": "selfprivacy" + } } \ No newline at end of file