diff --git a/.vscode/launch.json b/.vscode/launch.json index 5338493..f1ca559 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "go", "debugAdapter": "dlv-dap", "request": "launch", - "port": 39117, + "port": 34155, "host": "127.0.0.1", "mode": "exec", "program": "${workspaceFolder}/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service" diff --git a/service/authentik.go b/service/authentik.go index 99f6e7c..f0d0fb6 100644 --- a/service/authentik.go +++ b/service/authentik.go @@ -40,6 +40,10 @@ func (a *authentikService) UpdateSettings(m model2.AuthentikCredentialsDBModel) var existing model2.AuthentikCredentialsDBModel result := a.db.First(&existing) if result.Error != nil { + if result.Error.Error() == "record not found" { + a.db.Create(&m) + return existing, nil + } return existing, result.Error }