mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-31 05:06:41 +00:00
refactor: remove auth migration
This commit is contained in:
parent
319135a333
commit
57ee76b2fd
|
@ -1,35 +0,0 @@
|
||||||
from selfprivacy_api.migrations.migration import Migration
|
|
||||||
|
|
||||||
from selfprivacy_api.services.flake_service_manager import FlakeServiceManager
|
|
||||||
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
|
||||||
|
|
||||||
|
|
||||||
class AddAuth(Migration):
|
|
||||||
"""Adds auth (kanidm) service if it is not present."""
|
|
||||||
|
|
||||||
def get_migration_name(self) -> str:
|
|
||||||
return "add_auth"
|
|
||||||
|
|
||||||
def get_migration_description(self) -> str:
|
|
||||||
return "Adds the auth (Kanidm) if it is not present."
|
|
||||||
|
|
||||||
def is_migration_needed(self) -> bool:
|
|
||||||
with FlakeServiceManager() as manager:
|
|
||||||
if "auth" not in manager.services:
|
|
||||||
return True
|
|
||||||
with ReadUserData() as data:
|
|
||||||
if "auth" not in data["modules"]:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def migrate(self) -> None:
|
|
||||||
with FlakeServiceManager() as manager:
|
|
||||||
if "auth" not in manager.services:
|
|
||||||
manager.services["monitoring"] = (
|
|
||||||
"git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=sso&rev=f795bc977f03de64c10a62528bfa04a88f2611ca&dir=sp-modules/auth"
|
|
||||||
)
|
|
||||||
with WriteUserData() as data:
|
|
||||||
if "monitoring" not in data["modules"]:
|
|
||||||
data["modules"]["monitoring"] = {
|
|
||||||
"enable": False,
|
|
||||||
}
|
|
Loading…
Reference in a new issue