detached f6f7f5e

proxy: use from .env everywhere

commit
f6f7f5e13c004a310e1ed04ef380d1245fb3b2d1
author
bnema · · 2024-04-19 17:17 UTC
parent
fbfa93c
signature
unsigned
5 files · +713 -258
D .github/workflows/go.yml +0 -63
@@ -1,63 +0,0 @@
1-name: Release
2-
3-on:
4- push:
5- tags:
6- - '*'
7-
8-jobs:
9- release:
10- runs-on: ubuntu-latest
11- steps:
12- - uses: actions/checkout@v3
13-
14- - name: Set up Go
15- uses: actions/setup-go@v3
16- with:
17- go-version: 1.21
18-
19- - name: Build
20- run: |
21- go mod tidy
22- mkdir -p bin
23- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-linux-amd64 ./cmd/cli/main.go
24- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-windows-amd64.exe ./cmd/cli/main.go
25- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-darwin-amd64 ./cmd/cli/main.go
26- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-linux-arm64 ./cmd/cli/main.go
27- CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-windows-arm64.exe ./cmd/cli/main.go
28- CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-darwin-arm64 ./cmd/cli/main.go
29-
30- - name: Build Docker Images
31- run: |
32- docker buildx build --platform linux/amd64 --tag ghcr.io/bnema/gordon:${{ github.ref_name }}-amd64 --label org.opencontainers.image.created=$(date +'%Y-%m-%dT%H:%M:%SZ') --label org.opencontainers.image.title=gordon --label org.opencontainers.image.revision=${{ github.sha }} --label org.opencontainers.image.version=${{ github.ref_name }} --label org.opencontainers.image.source=https://github.com/bnema/gordon --build-arg BINARY=bin/gordon-linux-amd64 --push .
33- docker buildx build --platform linux/arm64 --tag ghcr.io/bnema/gordon:${{ github.ref_name }}-arm64 --label org.opencontainers.image.created=$(date +'%Y-%m-%dT%H:%M:%SZ') --label org.opencontainers.image.title=gordon --label org.opencontainers.image.revision=${{ github.sha }} --label org.opencontainers.image.version=${{ github.ref_name }} --label org.opencontainers.image.source=https://github.com/bnema/gordon --build-arg BINARY=bin/gordon-linux-arm64 --push .
34- env:
35- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
37- - name: Create Docker Manifest
38- run: |
39- docker manifest create ghcr.io/bnema/gordon:latest ghcr.io/bnema/gordon:${{ github.ref_name }}-amd64 ghcr.io/bnema/gordon:${{ github.ref_name }}-arm64 --amend
40- docker manifest push ghcr.io/bnema/gordon:latest
41-
42- - name: Create Release Artifacts
43- run: |
44- zip -j gordon_${{ github.ref_name }}_linux_amd64.zip gordon-linux-amd64
45- zip -j gordon_${{ github.ref_name }}_windows_amd64.zip gordon-windows-amd64.exe
46- zip -j gordon_${{ github.ref_name }}_darwin_amd64.zip gordon-darwin-amd64
47- zip -j gordon_${{ github.ref_name }}_linux_arm64.zip gordon-linux-arm64
48- zip -j gordon_${{ github.ref_name }}_windows_arm64.zip gordon-windows-arm64.exe
49- zip -j gordon_${{ github.ref_name }}_darwin_arm64.zip gordon-darwin-arm64
50-
51- - name: Install Cosign
52- run: |
53- curl -sfL https://raw.githubusercontent.com/sigstore/cosign/main/install.sh | sudo sh
54-
55- - name: Create Release
56- uses: actions/create-release@v1
57- with:
58- tag_name: ${{ github.ref }}
59- release_name: Release ${{ github.ref }}
60- draft: true
61- prerelease: false
62- env:
63- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}⏎̸
@@ -1,63 +0,0 @@
1-name: Release
2-
3-on:
4- push:
5- tags:
6- - '*'
7-
8-jobs:
9- release:
10- runs-on: ubuntu-latest
11- steps:
12- - uses: actions/checkout@v3
13-
14- - name: Set up Go
15- uses: actions/setup-go@v3
16- with:
17- go-version: 1.21
18-
19- - name: Build
20- run: |
21- go mod tidy
22- mkdir -p bin
23- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-linux-amd64 ./cmd/cli/main.go
24- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-windows-amd64.exe ./cmd/cli/main.go
25- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-darwin-amd64 ./cmd/cli/main.go
26- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-linux-arm64 ./cmd/cli/main.go
27- CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-windows-arm64.exe ./cmd/cli/main.go
28- CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.build=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date +'%Y-%m-%dT%H:%M:%SZ')" -o bin/gordon-darwin-arm64 ./cmd/cli/main.go
29-
30- - name: Build Docker Images
31- run: |
32- docker buildx build --platform linux/amd64 --tag ghcr.io/bnema/gordon:${{ github.ref_name }}-amd64 --label org.opencontainers.image.created=$(date +'%Y-%m-%dT%H:%M:%SZ') --label org.opencontainers.image.title=gordon --label org.opencontainers.image.revision=${{ github.sha }} --label org.opencontainers.image.version=${{ github.ref_name }} --label org.opencontainers.image.source=https://github.com/bnema/gordon --build-arg BINARY=bin/gordon-linux-amd64 --push .
33- docker buildx build --platform linux/arm64 --tag ghcr.io/bnema/gordon:${{ github.ref_name }}-arm64 --label org.opencontainers.image.created=$(date +'%Y-%m-%dT%H:%M:%SZ') --label org.opencontainers.image.title=gordon --label org.opencontainers.image.revision=${{ github.sha }} --label org.opencontainers.image.version=${{ github.ref_name }} --label org.opencontainers.image.source=https://github.com/bnema/gordon --build-arg BINARY=bin/gordon-linux-arm64 --push .
34- env:
35- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
37- - name: Create Docker Manifest
38- run: |
39- docker manifest create ghcr.io/bnema/gordon:latest ghcr.io/bnema/gordon:${{ github.ref_name }}-amd64 ghcr.io/bnema/gordon:${{ github.ref_name }}-arm64 --amend
40- docker manifest push ghcr.io/bnema/gordon:latest
41-
42- - name: Create Release Artifacts
43- run: |
44- zip -j gordon_${{ github.ref_name }}_linux_amd64.zip gordon-linux-amd64
45- zip -j gordon_${{ github.ref_name }}_windows_amd64.zip gordon-windows-amd64.exe
46- zip -j gordon_${{ github.ref_name }}_darwin_amd64.zip gordon-darwin-amd64
47- zip -j gordon_${{ github.ref_name }}_linux_arm64.zip gordon-linux-arm64
48- zip -j gordon_${{ github.ref_name }}_windows_arm64.zip gordon-windows-arm64.exe
49- zip -j gordon_${{ github.ref_name }}_darwin_arm64.zip gordon-darwin-arm64
50-
51- - name: Install Cosign
52- run: |
53- curl -sfL https://raw.githubusercontent.com/sigstore/cosign/main/install.sh | sudo sh
54-
55- - name: Create Release
56- uses: actions/create-release@v1
57- with:
58- tag_name: ${{ github.ref }}
59- release_name: Release ${{ github.ref }}
60- draft: true
61- prerelease: false
62- env:
63- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}⏎̸
M cmd/cli/main.go +5 -1
@@ -3,6 +3,7 @@ package main
33 import (
44 "fmt"
55 "log"
6+ "os"
67 "regexp"
78
89 "github.com/bnema/gordon/internal/cli"
@@ -10,9 +11,9 @@ import (
1011 "github.com/bnema/gordon/internal/common"
1112 "github.com/bnema/gordon/internal/server"
1213 "github.com/spf13/cobra"
14+
1315 // env auto load
1416 _ "github.com/joho/godotenv/autoload"
15- "os"
1617 )
1718
1819 var (
@@ -45,6 +46,9 @@ func main() {
4546 ProxyURL: os.Getenv("PROXY_URL"),
4647 }
4748
49+ // console log proxy url
50+ log.Printf("Proxy URL: %s", buildInfo.ProxyURL)
51+
4852 a, err := cli.NewClientApp(buildInfo)
4953 if err != nil {
5054 fmt.Println("Error initializing app:", err)
@@ -3,6 +3,7 @@ package main
3 import (3 import (
4 "fmt"4 "fmt"
5 "log"5 "log"
6+ "os"
6 "regexp"7 "regexp"
7 8
8 "github.com/bnema/gordon/internal/cli"9 "github.com/bnema/gordon/internal/cli"
@@ -10,9 +11,9 @@ import (
10 "github.com/bnema/gordon/internal/common"11 "github.com/bnema/gordon/internal/common"
11 "github.com/bnema/gordon/internal/server"12 "github.com/bnema/gordon/internal/server"
12 "github.com/spf13/cobra"13 "github.com/spf13/cobra"
14+
13 // env auto load15 // env auto load
14 _ "github.com/joho/godotenv/autoload"16 _ "github.com/joho/godotenv/autoload"
15- "os"
16 )17 )
17 18
18 var (19 var (
@@ -45,6 +46,9 @@ func main() {
45 ProxyURL: os.Getenv("PROXY_URL"),46 ProxyURL: os.Getenv("PROXY_URL"),
46 }47 }
47 48
49+ // console log proxy url
50+ log.Printf("Proxy URL: %s", buildInfo.ProxyURL)
51+
48 a, err := cli.NewClientApp(buildInfo)52 a, err := cli.NewClientApp(buildInfo)
49 if err != nil {53 if err != nil {
50 fmt.Println("Error initializing app:", err)54 fmt.Println("Error initializing app:", err)
M internal/httpserve/middleware/secure.go +1 -1
@@ -13,7 +13,7 @@ import (
1313 )
1414
1515 func SecureRoutes(a *server.App) echo.MiddlewareFunc {
16- proxyURL := a.Config.Build.ProxyURL // <-- https://gordon-proxy.bnema.dev
16+ proxyURL := a.Config.Build.ProxyURL
1717 urlCheckVersion := a.Config.Build.ProxyURL + "/version"
1818 return middleware.SecureWithConfig(middleware.SecureConfig{
1919 XSSProtection: "1; mode=block",
@@ -13,7 +13,7 @@ import (
13 )13 )
14 14
15 func SecureRoutes(a *server.App) echo.MiddlewareFunc {15 func SecureRoutes(a *server.App) echo.MiddlewareFunc {
16- proxyURL := a.Config.Build.ProxyURL // <-- https://gordon-proxy.bnema.dev16+ proxyURL := a.Config.Build.ProxyURL
17 urlCheckVersion := a.Config.Build.ProxyURL + "/version"17 urlCheckVersion := a.Config.Build.ProxyURL + "/version"
18 return middleware.SecureWithConfig(middleware.SecureConfig{18 return middleware.SecureWithConfig(middleware.SecureConfig{
19 XSSProtection: "1; mode=block",19 XSSProtection: "1; mode=block",
M package-lock.json +704 -193 generated file: collapsed
M package.json +3 -0
@@ -8,5 +8,8 @@
88 "scripts": {
99 "build:css": "tailwindcss build src/styles.css -o dist/styles.css",
1010 "dev:css": "tailwindcss -i internal/webui/public/assets/css/custom.css -o internal/webui/public/assets/css/tailwind.css --watch"
11+ },
12+ "dependencies": {
13+ "dotenv": "^16.4.5"
1114 }
1215 }
@@ -8,5 +8,8 @@
8 "scripts": {8 "scripts": {
9 "build:css": "tailwindcss build src/styles.css -o dist/styles.css",9 "build:css": "tailwindcss build src/styles.css -o dist/styles.css",
10 "dev:css": "tailwindcss -i internal/webui/public/assets/css/custom.css -o internal/webui/public/assets/css/tailwind.css --watch"10 "dev:css": "tailwindcss -i internal/webui/public/assets/css/custom.css -o internal/webui/public/assets/css/tailwind.css --watch"
11+ },
12+ "dependencies": {
13+ "dotenv": "^16.4.5"
11 }14 }
12 }15 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close