mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 03:41:01 +00:00
Allow to configure port for SSL (#1735)
Co-authored-by: Mehdi Katranji <hello@mek.yt> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
6d2240b2e6
commit
41a50ae915
4 changed files with 15 additions and 2 deletions
|
@ -56,6 +56,12 @@ var flags = []cli.Flag{
|
|||
Usage: "server address",
|
||||
Value: ":8000",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
EnvVars: []string{"WOODPECKER_SERVER_ADDR_TLS"},
|
||||
Name: "server-addr-tls",
|
||||
Usage: "port https with tls (:443)",
|
||||
Value: ":443",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
EnvVars: []string{"WOODPECKER_SERVER_CERT"},
|
||||
Name: "server-cert",
|
||||
|
|
|
@ -210,7 +210,7 @@ func run(c *cli.Context) error {
|
|||
// start the server with tls enabled
|
||||
g.Go(func() error {
|
||||
serve := &http.Server{
|
||||
Addr: ":https",
|
||||
Addr: server.Config.Server.PortTLS,
|
||||
Handler: handler,
|
||||
TLSConfig: &tls.Config{
|
||||
NextProtos: []string{"h2", "http/1.1"},
|
||||
|
@ -236,7 +236,7 @@ func run(c *cli.Context) error {
|
|||
}
|
||||
|
||||
g.Go(func() error {
|
||||
return http.ListenAndServe(":http", http.HandlerFunc(redirect))
|
||||
return http.ListenAndServe(server.Config.Server.Port, http.HandlerFunc(redirect))
|
||||
})
|
||||
} else if c.Bool("lets-encrypt") {
|
||||
// start the server with lets-encrypt
|
||||
|
@ -350,6 +350,7 @@ func setupEvilGlobals(c *cli.Context, v store.Store, f forge.Forge) {
|
|||
server.Config.Server.OAuthHost = c.String("server-host")
|
||||
}
|
||||
server.Config.Server.Port = c.String("server-addr")
|
||||
server.Config.Server.PortTLS = c.String("server-addr-tls")
|
||||
server.Config.Server.Docs = c.String("docs")
|
||||
server.Config.Server.StatusContext = c.String("status-context")
|
||||
server.Config.Server.StatusContextFormat = c.String("status-context-format")
|
||||
|
|
|
@ -136,6 +136,11 @@ Example: `WOODPECKER_HOST=http://woodpecker.example.org`
|
|||
|
||||
Configures the HTTP listener port.
|
||||
|
||||
### `WOODPECKER_SERVER_ADDR_TLS`
|
||||
> Default: `:443`
|
||||
|
||||
Configures the HTTPS listener port when SSL is enabled.
|
||||
|
||||
### `WOODPECKER_SERVER_CERT`
|
||||
> Default: empty
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ var Config = struct {
|
|||
OAuthHost string
|
||||
Host string
|
||||
Port string
|
||||
PortTLS string
|
||||
AgentToken string
|
||||
Docs string
|
||||
StatusContext string
|
||||
|
|
Loading…
Reference in a new issue