Use PanelDomain in help texts

This commit is contained in:
Tom Wiesing 2023-11-02 14:44:09 +01:00
parent 6b3460c702
commit 9a3e508ce8
No known key found for this signature in database
4 changed files with 12 additions and 9 deletions

View file

@ -41,7 +41,8 @@ type HTTPConfig struct {
PhpMyAdmin validators.NullableBool `yaml:"phpmyadmin" validate:"bool" default:"false"`
}
func (hcfg HTTPConfig) PublicTopDomain() string {
// PanelDomain is the domain name where the control panel runs.
func (hcfg HTTPConfig) PanelDomain() string {
// if we have panel domain enabled, then return it
if hcfg.Panel.Set && hcfg.Panel.Value {
return hcfg.PrimaryDomain
@ -81,7 +82,7 @@ func (hcfg HTTPConfig) optionalURL(domain string, enabled validators.NullableBoo
func (hcfg HTTPConfig) JoinPath(elem ...string) *url.URL {
u := url.URL{
Scheme: "http",
Host: hcfg.PublicTopDomain(),
Host: hcfg.PanelDomain(),
Path: "/",
}
if hcfg.HTTPSEnabled() {

View file

@ -34,8 +34,9 @@ type SSHTemplateContext struct {
Keys []models.Keys
Domain string // domain name of the distillery
Port uint16 // public port of the distillery ssh servers
Domain string // domain name of the distillery
PanelDomain string // domain name of the panel
Port uint16 // public port of the distillery ssh servers
Slug string // slug of the wisski
Hostname string // hostname of an example wisski
@ -62,7 +63,8 @@ func (panel *UserPanel) sshRoute(ctx context.Context) http.Handler {
return sc, err
}
sc.Domain = panel.Config.HTTP.PublicTopDomain()
sc.Domain = panel.Config.HTTP.PrimaryDomain
sc.PanelDomain = panel.Config.HTTP.PanelDomain()
sc.Port = panel.Config.Listen.SSHPort
// pick the first domain that the user has access to as an example

View file

@ -72,7 +72,7 @@
From a Linux (or Mac, or Windows 11) command line you may use:
</p>
<code class="copy">
ssh -J {{ .Domain }}:{{ .Port }} www-data@{{ .Hostname }}
ssh -J {{ .PanelDomain }}:{{ .Port }} www-data@{{ .Hostname }}
</code>
<p>
You may also place the following into your <code>$HOME/.ssh/config</code> file:
@ -83,7 +83,7 @@
User www-data
Host {{ .Domain }}.proxy
User www-data
Hostname {{ .Domain }}
Hostname {{ .PanelDomain }}
Port {{ .Port }}
</pre>
</code>
@ -110,7 +110,7 @@ Host {{ .Domain }}.proxy
</p>
<code class="copy">
<pre>
ssh -p {{ .Port }} {{ .Domain }} -L 7200:triplestore:7200
ssh -p {{ .Port }} {{ .PanelDomain }} -L 7200:triplestore:7200
</pre>
</code>
<p>

View file

@ -45,7 +45,7 @@ func (ssh2 *SSH2) handleConnection(session ssh.Session) {
{"${SLUG}", slug},
{"${HOSTNAME}", slug + "." + ssh2.Config.HTTP.PrimaryDomain},
{"${DOMAIN}", ssh2.Config.HTTP.PublicTopDomain()},
{"${DOMAIN}", ssh2.Config.HTTP.PanelDomain()},
{"${PORT}", strconv.FormatUint(uint64(ssh2.Config.Listen.SSHPort), 10)},
{"${HELP_URL}", ssh2.Config.HTTP.JoinPath("user", "ssh").String()},