Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
chore(deps): Bumping httputils to v4
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <bob@vibioh.fr>
  • Loading branch information
ViBiOh committed Feb 20, 2021
1 parent b523179 commit 2f10688
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 40 deletions.
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If something goes wrong during the deploy process, the uploaded `docker-compose.
```bash
Usage of deploy:
-address string
[http] Listen address {DEPLOY_ADDRESS}
[server] Listen address {DEPLOY_ADDRESS}
-annotationPass string
[annotation] Pass {DEPLOY_ANNOTATION_PASS}
-annotationURL string
Expand All @@ -53,7 +53,7 @@ Usage of deploy:
-apiTempFolder string
[api] Temp folder for uploading files {DEPLOY_API_TEMP_FOLDER} (default "/tmp")
-cert string
[http] Certificate file {DEPLOY_CERT}
[server] Certificate file {DEPLOY_CERT}
-csp string
[owasp] Content-Security-Policy {DEPLOY_CSP} (default "default-src 'self'; base-uri 'self'")
-frameOptions string
Expand All @@ -63,9 +63,9 @@ Usage of deploy:
-hsts
[owasp] Indicate Strict Transport Security {DEPLOY_HSTS} (default true)
-idleTimeout string
[http] Idle Timeout {DEPLOY_IDLE_TIMEOUT} (default "2m")
[server] Idle Timeout {DEPLOY_IDLE_TIMEOUT} (default "2m")
-key string
[http] Key file {DEPLOY_KEY}
[server] Key file {DEPLOY_KEY}
-loggerJson
[logger] Log format as JSON {DEPLOY_LOGGER_JSON}
-loggerLevel string
Expand All @@ -76,30 +76,44 @@ Usage of deploy:
[logger] Key for message in JSON {DEPLOY_LOGGER_MESSAGE_KEY} (default "message")
-loggerTimeKey string
[logger] Key for timestamp in JSON {DEPLOY_LOGGER_TIME_KEY} (default "time")
-mailerPass string
[mailer] Pass {DEPLOY_MAILER_PASS}
-mailerName string
[mailer] HTTP Username or AMQP Exchange name {DEPLOY_MAILER_NAME} (default "mailer")
-mailerPassword string
[mailer] HTTP Pass {DEPLOY_MAILER_PASSWORD}
-mailerURL string
[mailer] URL (an instance of github.com/ViBiOh/mailer) {DEPLOY_MAILER_URL}
-mailerUser string
[mailer] User {DEPLOY_MAILER_USER}
[mailer] URL (https?:// or amqps?://) {DEPLOY_MAILER_URL}
-okStatus int
[http] Healthy HTTP Status code {DEPLOY_OK_STATUS} (default 204)
-port uint
[http] Listen port {DEPLOY_PORT} (default 1080)
[server] Listen port {DEPLOY_PORT} (default 1080)
-prometheusAddress string
[prometheus] Listen address {DEPLOY_PROMETHEUS_ADDRESS}
-prometheusCert string
[prometheus] Certificate file {DEPLOY_PROMETHEUS_CERT}
-prometheusIdleTimeout string
[prometheus] Idle Timeout {DEPLOY_PROMETHEUS_IDLE_TIMEOUT} (default "10s")
-prometheusIgnore string
[prometheus] Ignored path prefixes for metrics, comma separated {DEPLOY_PROMETHEUS_IGNORE}
-prometheusPath string
[prometheus] Path for exposing metrics {DEPLOY_PROMETHEUS_PATH} (default "/metrics")
-prometheusKey string
[prometheus] Key file {DEPLOY_PROMETHEUS_KEY}
-prometheusPort uint
[prometheus] Listen port {DEPLOY_PROMETHEUS_PORT} (default 9090)
-prometheusReadTimeout string
[prometheus] Read Timeout {DEPLOY_PROMETHEUS_READ_TIMEOUT} (default "5s")
-prometheusShutdownTimeout string
[prometheus] Shutdown Timeout {DEPLOY_PROMETHEUS_SHUTDOWN_TIMEOUT} (default "5s")
-prometheusWriteTimeout string
[prometheus] Write Timeout {DEPLOY_PROMETHEUS_WRITE_TIMEOUT} (default "10s")
-readTimeout string
[http] Read Timeout {DEPLOY_READ_TIMEOUT} (default "5s")
[server] Read Timeout {DEPLOY_READ_TIMEOUT} (default "5s")
-shutdownTimeout string
[http] Shutdown Timeout {DEPLOY_SHUTDOWN_TIMEOUT} (default "10s")
[server] Shutdown Timeout {DEPLOY_SHUTDOWN_TIMEOUT} (default "10s")
-url string
[alcotest] URL to check {DEPLOY_URL}
-userAgent string
[alcotest] User-Agent for check {DEPLOY_USER_AGENT} (default "Alcotest")
-writeTimeout string
[http] Write Timeout {DEPLOY_WRITE_TIMEOUT} (default "2m")
[server] Write Timeout {DEPLOY_WRITE_TIMEOUT} (default "2m")
```
## License
Expand Down
33 changes: 23 additions & 10 deletions cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ import (

"github.com/ViBiOh/deploy/pkg/annotation"
"github.com/ViBiOh/deploy/pkg/api"
"github.com/ViBiOh/httputils/v3/pkg/alcotest"
"github.com/ViBiOh/httputils/v3/pkg/flags"
"github.com/ViBiOh/httputils/v3/pkg/httputils"
"github.com/ViBiOh/httputils/v3/pkg/logger"
"github.com/ViBiOh/httputils/v3/pkg/owasp"
"github.com/ViBiOh/httputils/v3/pkg/prometheus"
"github.com/ViBiOh/httputils/v4/pkg/alcotest"
"github.com/ViBiOh/httputils/v4/pkg/flags"
"github.com/ViBiOh/httputils/v4/pkg/health"
"github.com/ViBiOh/httputils/v4/pkg/httputils"
"github.com/ViBiOh/httputils/v4/pkg/logger"
"github.com/ViBiOh/httputils/v4/pkg/owasp"
"github.com/ViBiOh/httputils/v4/pkg/prometheus"
"github.com/ViBiOh/httputils/v4/pkg/server"
"github.com/ViBiOh/mailer/pkg/client"
mailer "github.com/ViBiOh/mailer/pkg/client"
)

func main() {
fs := flag.NewFlagSet("deploy", flag.ExitOnError)

serverConfig := httputils.Flags(fs, "", flags.NewOverride("WriteTimeout", "2m"))
appServerConfig := server.Flags(fs, "", flags.NewOverride("WriteTimeout", "2m"))
promServerConfig := server.Flags(fs, "prometheus", flags.NewOverride("Port", 9090), flags.NewOverride("IdleTimeout", "10s"), flags.NewOverride("ShutdownTimeout", "5s"))
healthConfig := health.Flags(fs, "")

alcotestConfig := alcotest.Flags(fs, "")
loggerConfig := logger.Flags(fs, "logger")
prometheusConfig := prometheus.Flags(fs, "prometheus")
Expand All @@ -35,15 +40,23 @@ func main() {
logger.Global(logger.New(loggerConfig))
defer logger.Close()

appServer := server.New(appServerConfig)
promServer := server.New(promServerConfig)
prometheusApp := prometheus.New(prometheusConfig)
healthApp := health.New(healthConfig)

mailerApp, err := mailer.New(mailerConfig)
logger.Fatal(err)
defer mailerApp.Close()

annotationApp := annotation.New(annotationConfig)
apiApp := api.New(apiConfig, mailerApp, annotationApp)

server := httputils.New(serverConfig)
go apiApp.Start(server.GetDone())
go apiApp.Start(healthApp.Done())

go promServer.Start("prometheus", healthApp.End(), prometheusApp.Handler())
go appServer.Start("http", healthApp.End(), httputils.Handler(apiApp.Handler(), healthApp, prometheusApp.Middleware, owasp.New(owaspConfig).Middleware))

server.ListenAndServe(apiApp.Handler(), nil, prometheus.New(prometheusConfig).Middleware, owasp.New(owaspConfig).Middleware)
healthApp.WaitForTermination(appServer.Done())
server.GracefulWait(appServer.Done(), promServer.Done())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/ViBiOh/deploy
go 1.16

require (
github.com/ViBiOh/httputils/v3 v3.37.2
github.com/ViBiOh/httputils/v4 v4.0.0
github.com/ViBiOh/mailer v1.14.0
)
12 changes: 4 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/ViBiOh/httputils/v3 v3.37.2 h1:b3Hm7+PbyBAIitdT0vEvATjZj8lIZ2+0tC8Ecfgd+MI=
github.com/ViBiOh/httputils/v3 v3.37.2/go.mod h1:PocQEM67sTVg51k0kYtoSA3JrwZmEVo5aIBqto/JKek=
github.com/ViBiOh/httputils/v4 v4.0.0 h1:FW7YanNVCcDaKCQ7UAramPv2ovuW2OZndYs8ftHEFb8=
github.com/ViBiOh/httputils/v4 v4.0.0/go.mod h1:+mwW3YVDPI9y1Fx1ZXbehJPqWDFtlDLsNL5otGeBSBw=
github.com/ViBiOh/mailer v1.14.0 h1:PwlsCzypGEfNzH0f6/TocHDKlYkNGbFa7BWG0X3XSlg=
github.com/ViBiOh/mailer v1.14.0/go.mod h1:meIw1djU80vo0LVhuc/MJOo4YmX2swiW6D9w7hLCRxk=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
Expand Down Expand Up @@ -88,7 +90,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
Expand Down Expand Up @@ -217,7 +218,6 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU=
github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU=
Expand All @@ -231,15 +231,13 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
Expand Down Expand Up @@ -271,7 +269,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tdewolff/minify/v2 v2.9.12/go.mod h1:yuntVVAFuGyi9VmiRoUqAYEQnFCGO929ytj2ITMZuB8=
github.com/tdewolff/minify/v2 v2.9.13/go.mod h1:faNOp+awAoo+fhFHD+NAkBOaXBAvJI2X2SDERGKnARo=
github.com/tdewolff/parse/v2 v2.5.9/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
github.com/tdewolff/parse/v2 v2.5.10/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
Expand Down Expand Up @@ -300,9 +300,7 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
Expand Down Expand Up @@ -351,9 +349,7 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
4 changes: 2 additions & 2 deletions pkg/annotation/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"flag"
"strings"

"github.com/ViBiOh/httputils/v3/pkg/flags"
"github.com/ViBiOh/httputils/v3/pkg/request"
"github.com/ViBiOh/httputils/v4/pkg/flags"
"github.com/ViBiOh/httputils/v4/pkg/request"
)

// App of package
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/api.go
Original file line number Diff line number Diff line change