Skip to content

Commit

Permalink
feat(gateway): add env variable to control tunnels domain
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybarreto authored and gustavosbarreto committed Dec 10, 2024
1 parent 1d41a67 commit 4fd1cde
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ SHELLHUB_DOMAIN=localhost
# VALUES: A valid network name
SHELLHUB_NETWORK=shellhub_network

# Enable tunnels feature.
SHELLHUB_TUNNELS=false

# The domain used to create the tunnels. If empty, the [SHELLHUB_DOMAIN] will be used.
SHELLHUB_TUNNELS_DOMAIN=

# Specifies an alternative mirror URL for downloading the GeoIP databases. This
# field takes precedence over SHELLHUB_MAXMIND_LICENSE; when both are
# configured, SHELLHUB_MAXMIND_MIRROR will be used as the primary source for
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ services:
environment:
- SHELLHUB_DOMAIN=${SHELLHUB_DOMAIN}
- SHELLHUB_TUNNELS=${SHELLHUB_TUNNELS}
- SHELLHUB_TUNNELS_DOMAIN=${SHELLHUB_TUNNELS_DOMAIN}
- SHELLHUB_VERSION=${SHELLHUB_VERSION}
- SHELLHUB_SSH_PORT=${SHELLHUB_SSH_PORT}
- SHELLHUB_PROXY=${SHELLHUB_PROXY}
Expand Down
1 change: 1 addition & 0 deletions gateway/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type GatewayConfig struct {
Env string `env:"SHELLHUB_ENV"`
Domain string `env:"SHELLHUB_DOMAIN,required" validate:"hostname"`
Tunnels bool `env:"SHELLHUB_TUNNELS,default=false"`
TunnelsDomain string `env:"SHELLHUB_TUNNELS_DOMAIN"`
WorkerProcesses string `env:"WORKER_PROCESSES,default=auto"`
MaxWorkerOpenFiles int `env:"MAX_WORKER_OPEN_FILES,default=0"`
MaxWorkerConnections int `env:"MAX_WORKER_CONNECTIONS,default=16384"`
Expand Down
2 changes: 1 addition & 1 deletion gateway/nginx/conf.d/shellhub.conf
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ server {
}

{{ if and $cfg.EnableEnterprise $cfg.Tunnels -}}
{{ $DOMAIN := $cfg.Domain }}
{{ $DOMAIN := or $cfg.TunnelsDomain $cfg.Domain }}
server {
{{ if and ($cfg.EnableAutoSSL) (ne $cfg.Env "development") -}}
listen 443;
Expand Down

0 comments on commit 4fd1cde

Please sign in to comment.