mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
chore: 🔧 Changes that do not modify src or test files
This commit is contained in:
parent
5343d8c934
commit
b84b3ba9f4
@ -1,14 +1,9 @@
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
.github
|
||||
.git
|
||||
.gitignore
|
||||
.editorconfig
|
||||
.idea
|
||||
.vscode
|
||||
test
|
||||
temp
|
||||
tmp
|
||||
LICENSE
|
||||
Makefile
|
||||
error-pages
|
||||
## Ignore everything
|
||||
*
|
||||
|
||||
## Except the following files and directories
|
||||
!/cmd
|
||||
!/internal
|
||||
!/templates
|
||||
!/error-pages.yml
|
||||
!/go.*
|
||||
|
@ -7,11 +7,8 @@ charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{yml, yaml, sh, conf, json}]
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[{Makefile, go.mod, *.go}]
|
||||
indent_style = tab
|
||||
|
2
Makefile
2
Makefile
@ -3,7 +3,7 @@
|
||||
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>
|
||||
|
||||
SHELL = /bin/sh
|
||||
LDFLAGS = "-s -w -X github.com/tarampampam/error-pages/internal/version.version=$(shell git rev-parse HEAD)"
|
||||
LDFLAGS = "-s -w -X gh.tarampamp.am/error-pages/internal/version.version=$(shell git rev-parse HEAD)"
|
||||
|
||||
DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
|
||||
APP_NAME = $(notdir $(CURDIR))
|
||||
|
@ -1,17 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
crypto "crypto/rand"
|
||||
"encoding/binary"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"go.uber.org/automaxprocs/maxprocs"
|
||||
|
||||
"github.com/tarampampam/error-pages/internal/cli"
|
||||
"gh.tarampamp.am/error-pages/internal/cli"
|
||||
)
|
||||
|
||||
// set GOMAXPROCS to match Linux container CPU quota.
|
||||
@ -26,15 +22,6 @@ func main() { exitFn(run()) }
|
||||
// run this CLI application.
|
||||
// Exit codes documentation: <https://tldp.org/LDP/abs/html/exitcodes.html>
|
||||
func run() int {
|
||||
var b [8]byte
|
||||
|
||||
// seed random number generator
|
||||
if _, err := crypto.Read(b[:]); err == nil {
|
||||
rand.Seed(int64(binary.LittleEndian.Uint64(b[:]))) // https://stackoverflow.com/a/54491783/2252921
|
||||
} else {
|
||||
rand.Seed(time.Now().UnixNano()) // fallback
|
||||
}
|
||||
|
||||
if err := (cli.NewApp(filepath.Base(os.Args[0]))).Run(os.Args); err != nil {
|
||||
_, _ = color.New(color.FgHiRed, color.Bold).Fprintln(os.Stderr, err.Error())
|
||||
|
||||
|
@ -4,6 +4,7 @@ version: '3.8'
|
||||
|
||||
volumes:
|
||||
tmp-data: {}
|
||||
golint-go: {}
|
||||
golint-cache: {}
|
||||
|
||||
services:
|
||||
@ -18,27 +19,29 @@ services:
|
||||
- /etc/group:/etc/group:ro
|
||||
- .:/src:rw
|
||||
- tmp-data:/tmp:rw
|
||||
security_opt: [no-new-privileges:true]
|
||||
|
||||
web:
|
||||
<<: *app-service
|
||||
ports:
|
||||
- "8080:8080/tcp" # Open <http://127.0.0.1:8080>
|
||||
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve"
|
||||
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve --show-details --proxy-headers=X-Foo,Bar,Baz_blah"
|
||||
healthcheck:
|
||||
test: ['CMD', '/tmp/app', '--log-json', 'healthcheck']
|
||||
interval: 4s
|
||||
timeout: 1s
|
||||
start_period: 5s
|
||||
retries: 5
|
||||
|
||||
golint:
|
||||
image: golangci/golangci-lint:v1.51-alpine # Image page: <https://hub.docker.com/r/golangci/golangci-lint>
|
||||
environment:
|
||||
GOLANGCI_LINT_CACHE: /tmp/golint # <https://github.com/golangci/golangci-lint/blob/v1.42.0/internal/cache/default.go#L68>
|
||||
volumes:
|
||||
- .:/src:ro
|
||||
- golint-go:/go:rw # go dependencies will be downloaded on each run without this
|
||||
- golint-cache:/tmp/golint:rw
|
||||
- .:/src:ro
|
||||
working_dir: /src
|
||||
command: /bin/true
|
||||
security_opt: [no-new-privileges:true]
|
||||
|
||||
hurl:
|
||||
image: orangeopensource/hurl:1.8.0
|
||||
@ -47,3 +50,4 @@ services:
|
||||
working_dir: /src
|
||||
depends_on:
|
||||
web: {condition: service_healthy}
|
||||
security_opt: [no-new-privileges:true]
|
||||
|
Loading…
Reference in New Issue
Block a user