feat: Add custom instance names (#399)

* Add custom name variable

* Add custom name variable usage to docs

* Remove leftover testing config options (oops)
This commit is contained in:
Sangelo 2024-12-15 17:39:51 +01:00 committed by GitHub
parent 00951bf63b
commit 20aef5e694
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1401 additions and 1387 deletions

View file

@ -38,7 +38,6 @@ git.default-branch:
# For SQLite databases only. # For SQLite databases only.
sqlite.journal-mode: WAL sqlite.journal-mode: WAL
# HTTP server configuration # HTTP server configuration
# Host to bind to. Default: 0.0.0.0 # Host to bind to. Default: 0.0.0.0
http.host: 0.0.0.0 http.host: 0.0.0.0
@ -72,7 +71,6 @@ ssh.external-domain:
# Path or alias to ssh-keygen executable. Default: ssh-keygen # Path or alias to ssh-keygen executable. Default: ssh-keygen
ssh.keygen-executable: ssh-keygen ssh.keygen-executable: ssh-keygen
# OAuth2 configuration # OAuth2 configuration
# The callback/redirect URL must be http://opengist.url/oauth/<github|gitlab|gitea|openid-connect>/callback # The callback/redirect URL must be http://opengist.url/oauth/<github|gitlab|gitea|openid-connect>/callback
@ -102,6 +100,9 @@ oidc.secret:
# Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration # Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration
oidc.discovery-url: oidc.discovery-url:
# Instance name
# Set your own custom name to be displayed instead of 'Opengist'
custom.name:
# Custom assets # Custom assets
# Add your own custom assets, that are files relatives to $opengist-home/custom/ # Add your own custom assets, that are files relatives to $opengist-home/custom/

View file

@ -37,6 +37,7 @@ aside: false
| oidc.client-key | OG_OIDC_CLIENT_KEY | none | The client key for the OpenID application. | | oidc.client-key | OG_OIDC_CLIENT_KEY | none | The client key for the OpenID application. |
| oidc.secret | OG_OIDC_SECRET | none | The secret for the OpenID application. | | oidc.secret | OG_OIDC_SECRET | none | The secret for the OpenID application. |
| oidc.discovery-url | OG_OIDC_DISCOVERY_URL | none | Discovery endpoint of the OpenID provider. | | oidc.discovery-url | OG_OIDC_DISCOVERY_URL | none | Discovery endpoint of the OpenID provider. |
| custom.name | OG_CUSTOM_NAME | none | The name of your instance, to be displayed in the tab title |
| custom.logo | OG_CUSTOM_LOGO | none | Path to an image, relative to $opengist-home/custom. | | custom.logo | OG_CUSTOM_LOGO | none | Path to an image, relative to $opengist-home/custom. |
| custom.favicon | OG_CUSTOM_FAVICON | none | Path to an image, relative to $opengist-home/custom. | | custom.favicon | OG_CUSTOM_FAVICON | none | Path to an image, relative to $opengist-home/custom. |
| custom.static-links | OG_CUSTOM_STATIC_LINK_#_(PATH,NAME) | none | Path and name to custom links, more info [here](custom-links.md). | | custom.static-links | OG_CUSTOM_STATIC_LINK_#_(PATH,NAME) | none | Path and name to custom links, more info [here](custom-links.md). |

View file

@ -29,3 +29,17 @@ custom.favicon: favicon.png
```sh ```sh
export OG_CUSTOM_FAVICON=favicon.png export OG_CUSTOM_FAVICON=favicon.png
``` ```
### Instance Name
It is also possible to set a name for your instance, that would be displayed in the title bar instead of 'Opengist'.
#### YAML
```yaml
custom.name: My Gists
```
#### Environment variable
```sh
export OG_CUSTOM_NAME="My Gists"
```

View file

@ -71,6 +71,7 @@ type config struct {
OIDCSecret string `yaml:"oidc.secret" env:"OG_OIDC_SECRET"` OIDCSecret string `yaml:"oidc.secret" env:"OG_OIDC_SECRET"`
OIDCDiscoveryUrl string `yaml:"oidc.discovery-url" env:"OG_OIDC_DISCOVERY_URL"` OIDCDiscoveryUrl string `yaml:"oidc.discovery-url" env:"OG_OIDC_DISCOVERY_URL"`
CustomName string `yaml:"custom.name" env:"OG_CUSTOM_NAME"`
CustomLogo string `yaml:"custom.logo" env:"OG_CUSTOM_LOGO"` CustomLogo string `yaml:"custom.logo" env:"OG_CUSTOM_LOGO"`
CustomFavicon string `yaml:"custom.favicon" env:"OG_CUSTOM_FAVICON"` CustomFavicon string `yaml:"custom.favicon" env:"OG_CUSTOM_FAVICON"`
StaticLinks []StaticLink `yaml:"custom.static-links" env:"OG_CUSTOM_STATIC_LINK"` StaticLinks []StaticLink `yaml:"custom.static-links" env:"OG_CUSTOM_STATIC_LINK"`

2759
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -46,9 +46,9 @@
{{ end }} {{ end }}
{{ if .htmlTitle }} {{ if .htmlTitle }}
<title>{{ .htmlTitle }} - Opengist</title> <title>{{ .htmlTitle }} - {{ if $.c.CustomName }}{{ $.c.CustomName }}{{ else }}Opengist{{ end }}</title>
{{ else }} {{ else }}
<title>Opengist</title> <title>{{ if $.c.CustomName }}{{ $.c.CustomName }}{{ else }}Opengist{{ end }}</title>
{{ end }} {{ end }}
</head> </head>
<body class="h-full"> <body class="h-full">