mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2026-04-20 22:13:30 +00:00
Compare commits
3 Commits
1bbe3102ce
...
v1.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
| fd51761ab5 | |||
| 16e5e9c010 | |||
| 916d2a2d86 |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore
|
||||||
|
### Go ###
|
||||||
# If you prefer the allow list template instead of the deny list, see community template:
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
#
|
#
|
||||||
@@ -20,10 +22,7 @@ bin/
|
|||||||
|
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
# End of gignore: github.com/onyx-and-iris/gignore
|
||||||
|
|
||||||
# Added by goreleaser init:
|
# Added by goreleaser init:
|
||||||
dist/
|
dist/
|
||||||
|
|
||||||
# testing
|
|
||||||
run.sh
|
|
||||||
server.yaml
|
|
||||||
14
README.md
14
README.md
@@ -22,9 +22,19 @@ Then just run the binary which you can compile yourself, download from `Releases
|
|||||||
|
|
||||||
### Logging
|
### Logging
|
||||||
|
|
||||||
Set the log level with environment variable `Q3RCON_LOGLEVEL`:
|
Set the log level with environment variable `Q3RCON_LOGLEVEL`.
|
||||||
|
|
||||||
`0 = Panic, 1 = Fatal, 2 = Error, 3 = Warning, 4 = Info, 5 = Debug, 6 = Trace`
|
Acceptable values are:
|
||||||
|
|
||||||
|
- `trace`
|
||||||
|
- `debug`
|
||||||
|
- `info`
|
||||||
|
- `warn`
|
||||||
|
- `error`
|
||||||
|
- `fatal`
|
||||||
|
- `panic`
|
||||||
|
|
||||||
|
If not set it will default to `info`.
|
||||||
|
|
||||||
### Special Thanks
|
### Special Thanks
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
|
includes:
|
||||||
|
docker: ./docker/Taskfile.docker.yml
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
PROGRAM: q3rcon-proxy
|
PROGRAM: q3rcon-proxy
|
||||||
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
||||||
@@ -38,11 +41,13 @@ tasks:
|
|||||||
desc: Build the q3rcon-proxy project for Windows
|
desc: Build the q3rcon-proxy project for Windows
|
||||||
cmds:
|
cmds:
|
||||||
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
||||||
|
internal: true
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
desc: Build the q3rcon-proxy project for Linux
|
desc: Build the q3rcon-proxy project for Linux
|
||||||
cmds:
|
cmds:
|
||||||
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
||||||
|
internal: true
|
||||||
|
|
||||||
test:
|
test:
|
||||||
desc: Run tests
|
desc: Run tests
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -13,13 +12,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logLevel, err := getEnvInt("Q3RCON_LOGLEVEL")
|
loglevel := os.Getenv("Q3RCON_LOGLEVEL")
|
||||||
|
if loglevel == "" {
|
||||||
|
loglevel = "info"
|
||||||
|
}
|
||||||
|
level, err := log.ParseLevel(loglevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("unable to parse Q3RCON_LEVEL: %s", err.Error())
|
fmt.Fprintf(os.Stderr, "Invalid log level: %s\n", loglevel)
|
||||||
}
|
os.Exit(1)
|
||||||
if slices.Contains(log.AllLevels, log.Level(logLevel)) {
|
|
||||||
log.SetLevel(log.Level(logLevel))
|
|
||||||
}
|
}
|
||||||
|
log.SetLevel(level)
|
||||||
|
|
||||||
proxyHost := os.Getenv("Q3RCON_PROXY_HOST")
|
proxyHost := os.Getenv("Q3RCON_PROXY_HOST")
|
||||||
if proxyHost == "" {
|
if proxyHost == "" {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.21 AS build_image
|
FROM golang:1.24 AS build_image
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
26
docker/Taskfile.docker.yml
Normal file
26
docker/Taskfile.docker.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
vars:
|
||||||
|
IMAGE: q3rcon-proxy
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
build:
|
||||||
|
desc: Build the Docker image
|
||||||
|
cmds:
|
||||||
|
- docker build -t {{.IMAGE}} -f docker/Dockerfile .
|
||||||
|
dir: .
|
||||||
|
|
||||||
|
login:
|
||||||
|
desc: Login to Github Container Registry
|
||||||
|
cmds:
|
||||||
|
- docker login ghcr.io -u {{.GHCR_USER}} --password-stdin <<< {{.GHCR_TOKEN}}
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
push:
|
||||||
|
desc: Push the Docker image to Github Container Registry
|
||||||
|
deps:
|
||||||
|
- task: build
|
||||||
|
- task: login
|
||||||
|
cmds:
|
||||||
|
- docker tag {{.IMAGE}} ghcr.io/{{.GHCR_USER}}/{{.IMAGE}}:latest
|
||||||
|
- docker push ghcr.io/{{.GHCR_USER}}/{{.IMAGE}}:latest
|
||||||
Reference in New Issue
Block a user