diff --git a/.vscode/launch.json b/.vscode/launch.json index 44a3e18..4b9e182 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "go", "debugAdapter": "dlv-dap", "request": "launch", - "port": 2346, + "port": 36425, "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/Makefile b/Makefile new file mode 100644 index 0000000..cfab9dc --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +GORELEASER=goreleaser +GORELEASERBUILD=$(GORELEASER) build +SERVICE = casaos-user-service +ARCHITECHTURE= amd64 +OS=linux +VERSION=v1 +BIN_PATH=build/sysroot/usr/bin +BUILD_PATH=build +CUR_DIR=$(PWD) +TAG=v1.2.5 +ARCHIVE_PATH=buildzip +PACKAGE_NAME=$(OS)-$(ARCHITECHTURE)-nextzenos-user-service-$(TAG) + +build-service: + $(GORELEASERBUILD) --clean --snapshot -f .goreleaser.debug.yaml --id $(SERVICE)-$(ARCHITECHTURE) + +package: + cp -f $(CUR_DIR)/dist/$(SERVICE)-$(ARCHITECHTURE)_$(OS)_$(ARCHITECHTURE)_$(VERSION)/$(BIN_PATH)/$(SERVICE) $(CUR_DIR)/$(BIN_PATH) \ + && tar -czvf $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(BUILD_PATH) + +archive_package: + mv $(PACKAGE_NAME).tar.gz $(CUR_DIR)/$(ARCHIVE_PATH) +remove_package: + rm $(PACKAGE_NAME).tar.gz +clear_archive: + rm -rf $(CUR_DIR)/$(ARCHIVE_PATH)/* \ No newline at end of file diff --git a/build/sysroot/usr/lib/systemd/system/casaos-user-service.service b/build/sysroot/usr/lib/systemd/system/casaos-user-service.service deleted file mode 100644 index 7fcff9f..0000000 --- a/build/sysroot/usr/lib/systemd/system/casaos-user-service.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -After=casaos-message-bus.service -Description=CasaOS User Service - -[Service] -ExecStartPre=/usr/bin/casaos-user-service -v -ExecStart=/usr/bin/casaos-user-service -c /etc/casaos/user-service.conf -PIDFile=/var/run/casaos/user-service.pid -Restart=always -Type=notify - -[Install] -WantedBy=multi-user.target diff --git a/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service b/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service index 6561263..35ba2a0 100755 Binary files a/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service and b/dist/casaos-user-service-amd64_linux_amd64_v1/build/sysroot/usr/bin/casaos-user-service differ diff --git a/dist/metadata.json b/dist/metadata.json index 514d96d..e10a952 100644 --- a/dist/metadata.json +++ b/dist/metadata.json @@ -1 +1 @@ -{"project_name":"casaos-user-service","tag":"v1.0.0","previous_tag":"","version":"1.0.1","commit":"87aab176d2716419944d8d34c9a5ee3d7bc63acd","date":"2024-09-07T11:45:04.418487229+07:00","runtime":{"goos":"linux","goarch":"amd64"}} \ No newline at end of file +{"project_name":"casaos-user-service","tag":"v1.0.0","previous_tag":"","version":"1.0.1","commit":"1f824d03e22d773d44c4c5658beff48afa991b80","date":"2024-09-24T14:53:28.796484573+07:00","runtime":{"goos":"linux","goarch":"amd64"}} \ No newline at end of file diff --git a/pkg/config/init.go b/pkg/config/init.go index 96c0e34..ac9b341 100644 --- a/pkg/config/init.go +++ b/pkg/config/init.go @@ -23,8 +23,6 @@ var ( LogPath: constants.DefaultLogPath, LogSaveName: "user", LogFileExt: "log", - OMVServer: constants.DefaultOMVServer, - SecretKey: constants.DefaultSecretKey, } Cfg *ini.File diff --git a/route/v1/user.go b/route/v1/user.go index 322ebf8..d79a01f 100644 --- a/route/v1/user.go +++ b/route/v1/user.go @@ -51,8 +51,8 @@ var ( clientSecret = "PE05fcDP4qESUmyZ1TNYpZNBxRPq70VpFI81vehsoJ6WhGz5yPXMljrFrOdMRdRhrYmF03fHWTZHgO9ZdNENrLN13BzL8CAgtEkTsyjXfgx9GvISheIjYfpSfvo219fL" authURL = "http://accessmanager.local/application/o/nextzenos-oidc/" //authURL = "http://10.0.0.26:9000/application/o/nextzenos-oidc/" - callbackURL = "http://nextzenos.local/v1/users/oidc/callback" - //callbackURL = "http://172.20.60.244:8080/v1/users/oidc/callback" + //callbackURL = "http://nextzenos.local/v1/users/oidc/callback" + callbackURL = "http://172.20.60.244:8080/v1/users/oidc/callback" ) // @Summary register user @@ -246,7 +246,7 @@ func CheckOIDCInit() gin.HandlerFunc { return func(c *gin.Context) { if !oidcInit { log.Println("Provider is Offline") - c.JSON(http.StatusServiceUnavailable, model.Result{Success: http.StatusServiceUnavailable, Message: "Authentik Server is Offline"}) + c.JSON(http.StatusServiceUnavailable, model.Result{Success: http.StatusProxyAuthRequired, Message: "Authentik Server is Offline"}) return } c.Next()