component/web: Add 'HTTPSMETHOD'
This commit sets the 'HTTPSMETHOD' variable on the 'web' component for when https is or is not enabled.
This commit is contained in:
parent
e1ee569629
commit
2ee90bf462
4 changed files with 11 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ services:
|
||||||
image: ghcr.io/nginx-proxy/nginx-proxy:alpine
|
image: ghcr.io/nginx-proxy/nginx-proxy:alpine
|
||||||
environment:
|
environment:
|
||||||
- DEFAULT_HOST=${DEFAULT_HOST}
|
- DEFAULT_HOST=${DEFAULT_HOST}
|
||||||
|
- HTTPS_METHOD=${HTTPS_METHOD}
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
DEFAULT_HOST=${DEFAULT_HOST}
|
DEFAULT_HOST=${DEFAULT_HOST}
|
||||||
|
HTTPS_METHOD=${HTTPS_METHOD}
|
||||||
6
env/component_web.go
vendored
6
env/component_web.go
vendored
|
|
@ -17,9 +17,15 @@ func (WebComponent) Name() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (web WebComponent) Stack() stack.Installable {
|
func (web WebComponent) Stack() stack.Installable {
|
||||||
|
HTTPS_METHOD := "nohttp"
|
||||||
|
if web.dis.HTTPSEnabled() {
|
||||||
|
HTTPS_METHOD = "redirect"
|
||||||
|
}
|
||||||
|
|
||||||
return web.dis.makeComponentStack(web, stack.Installable{
|
return web.dis.makeComponentStack(web, stack.Installable{
|
||||||
EnvContext: map[string]string{
|
EnvContext: map[string]string{
|
||||||
"DEFAULT_HOST": web.dis.Config.DefaultDomain,
|
"DEFAULT_HOST": web.dis.Config.DefaultDomain,
|
||||||
|
"HTTPS_METHOD": HTTPS_METHOD,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,9 @@ func (ds Stack) Update(io stream.IOStream, start bool) error {
|
||||||
var errStackUp = errors.New("Stack.Up: Up returned non-zero exit code")
|
var errStackUp = errors.New("Stack.Up: Up returned non-zero exit code")
|
||||||
|
|
||||||
// Up creates and starts the containers in this Stack.
|
// Up creates and starts the containers in this Stack.
|
||||||
// It is equivalent to 'docker compose up -d' on the shell.
|
// It is equivalent to 'docker compose up --remove-orphans --detach' on the shell.
|
||||||
func (ds Stack) Up(io stream.IOStream) error {
|
func (ds Stack) Up(io stream.IOStream) error {
|
||||||
code, err := ds.compose(io, "up", "-d")
|
code, err := ds.compose(io, "up", "--remove-orphans", "--detach")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue