Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
dec1ed84e3 | |||
a7324d7c32 | |||
c081c06239 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -12,21 +12,21 @@ jobs:
|
||||
name: Main Process
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO_VERSION: '1.20'
|
||||
GOLANGCI_LINT_VERSION: v1.53.3
|
||||
GO_VERSION: stable
|
||||
GOLANGCI_LINT_VERSION: v1.58.0
|
||||
CGO_ENABLED: 0
|
||||
|
||||
steps:
|
||||
|
||||
# https://github.com/marketplace/actions/checkout
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# https://github.com/marketplace/actions/setup-go-environment
|
||||
- name: Set up Go ${{ env.GO_VERSION }}
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
|
6
.github/workflows/go-cross.yml
vendored
6
.github/workflows/go-cross.yml
vendored
@ -15,17 +15,17 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.19, 1.x ]
|
||||
go-version: [ stable, oldstable ]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
# https://github.com/marketplace/actions/checkout
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# https://github.com/marketplace/actions/setup-go-environment
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
|
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@ -9,47 +9,47 @@ jobs:
|
||||
name: Release Process
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO_VERSION: '1.20'
|
||||
GO_VERSION: stable
|
||||
CGO_ENABLED: 0
|
||||
|
||||
steps:
|
||||
|
||||
# https://github.com/marketplace/actions/checkout
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# https://github.com/marketplace/actions/setup-go-environment
|
||||
- name: Set up Go ${{ env.GO_VERSION }}
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: dockerhub-login
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: ghcr-login
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: traefiker
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# https://goreleaser.com/ci/actions/
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }}
|
||||
|
@ -1,6 +1,5 @@
|
||||
run:
|
||||
timeout: 2m
|
||||
skip-files: []
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
@ -74,7 +73,8 @@ linters:
|
||||
- forbidigo
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- goerr113
|
||||
- err113
|
||||
- mnd
|
||||
- gomnd
|
||||
- gosec
|
||||
- lll
|
||||
@ -90,7 +90,7 @@ linters:
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
max-per-linter: 0
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
exclude:
|
||||
- 'package-comments: should have a package comment'
|
||||
|
@ -20,7 +20,7 @@ The optional `env` query parameter can be set to `true` to add the environment v
|
||||
|
||||
#### `/api`
|
||||
|
||||
Returns the whoami information as JSON.
|
||||
Returns the whoami information (and some extra information) as JSON.
|
||||
|
||||
The optional `env` query parameter can be set to `true` to add the environment variables to the response.
|
||||
|
||||
|
6
app.go
6
app.go
@ -31,7 +31,7 @@ const (
|
||||
var upgrader = websocket.Upgrader{
|
||||
ReadBufferSize: 1024,
|
||||
WriteBufferSize: 1024,
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
CheckOrigin: func(_ *http.Request) bool {
|
||||
return true
|
||||
},
|
||||
}
|
||||
@ -89,7 +89,7 @@ func main() {
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
if len(ca) > 0 {
|
||||
if ca != "" {
|
||||
server.TLSConfig = setupMutualTLS(ca)
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ func whoamiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
queryParams := r.URL.Query()
|
||||
|
||||
wait := queryParams.Get("wait")
|
||||
if len(wait) > 0 {
|
||||
if wait != "" {
|
||||
duration, err := time.ParseDuration(wait)
|
||||
if err == nil {
|
||||
time.Sleep(duration)
|
||||
|
6
go.mod
6
go.mod
@ -1,5 +1,7 @@
|
||||
module github.com/traefik/whoami
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require github.com/gorilla/websocket v1.4.2
|
||||
require github.com/gorilla/websocket v1.5.1
|
||||
|
||||
require golang.org/x/net v0.25.0 // indirect
|
||||
|
6
go.sum
6
go.sum
@ -1,2 +1,4 @@
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
|
Reference in New Issue
Block a user