chore:Add Makefile

This commit is contained in:
KaySar12 2024-09-24 18:36:59 +07:00
parent 1f824d03e2
commit e360248157
7 changed files with 31 additions and 20 deletions

2
.vscode/launch.json vendored
View File

@ -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"

26
Makefile Normal file
View File

@ -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)/*

View File

@ -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

2
dist/metadata.json vendored
View File

@ -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"}}
{"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"}}

View File

@ -23,8 +23,6 @@ var (
LogPath: constants.DefaultLogPath,
LogSaveName: "user",
LogFileExt: "log",
OMVServer: constants.DefaultOMVServer,
SecretKey: constants.DefaultSecretKey,
}
Cfg *ini.File

View File

@ -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()