Basic internal auth implementation
Some checks failed
ci/woodpecker/push/build Pipeline failed

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit was merged in pull request #5.
This commit is contained in:
2026-05-05 22:56:56 +02:00
committed by Nikolai Rodionov
parent 4d73dbfd44
commit f15608e0ab
18 changed files with 242 additions and 146 deletions

View File

@@ -2,6 +2,11 @@
version: "3"
vars:
LOCALBIN:
sh: echo "$(pwd)/bin"
MIGRATE: "{{.LOCALBIN}}/migrate"
tasks:
build:
desc: Build go code
@@ -38,3 +43,62 @@ tasks:
helmfile-deploy:
desc: Deploy the helmfile for the local dev
cmd: helmfile apply
get-proto-from-branch:
desc: Get the latest version of generated protobuf code from the branch
silent: true
vars:
WORKDIR:
sh: mktemp -d
cmds:
- git clone git@gitea.badhouseplants.net:softplayer/softplayer-go-proto.git '{{ .WORKDIR }}'
- git -C '{{ .WORKDIR }}' checkout '{{ .CLI_ARGS }}'
- go get gitea.badhouseplants.net/softplayer/softplayer-go-proto@$(git -C '{{ .WORKDIR }}' rev-parse HEAD)
- rm -rf '{{ .WORKDIR }}'
- go mod tidy
add-migration:
desc: Add a new database migration
silent: true
cmd: "{{.MIGRATE}} create -dir migrations -ext sql {{.CLI_ARGS}}"
# Install required tools
localbin:
desc: Create local bin directory
silent: true
cmds:
- mkdir -p "{{.LOCALBIN}}"
migrate:
desc: Download migrate if necessary
silent: true
deps:
- localbin
cmds:
- task: go-install-tool
vars:
TARGET: "{{.MIGRATE}}"
PACKAGE: github.com/golang-migrate/migrate/v4/cmd/migrate
VERSION: latest
go-install-tool:
internal: true
silent: true
cmd: |-
set -e
TARGET="{{.TARGET}}"
PACKAGE="{{.PACKAGE}}@{{.VERSION}}"
VERSIONED="${TARGET}-{{.VERSION}}"
if [ -f "$VERSIONED" ] && [ "$(readlink -- "$TARGET" 2>/dev/null)" = "$VERSIONED" ]; then
echo "$PACKAGE already installed"
exit 0
fi
echo "Downloading $PACKAGE"
rm -f "$TARGET"
GOBIN="{{.LOCALBIN}}" go install "$PACKAGE"
mv "{{.LOCALBIN}}/$(basename "$TARGET")" "$VERSIONED"
ln -sf "$(realpath "$VERSIONED")" "$TARGET"