File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { createMarkdownRenderer } from 'vitepress' ;
2+
3+ const SOURCE = 'https://raw.githubusercontent.com/gotify/server/master/gotify-server.env.example' ;
4+
5+ const uncomment = ( line : string ) : string => line . replace ( / ^ # ( ? ) / , '' ) ;
6+ const codeBlock = ( text : string ) => '```\n' + text . trimEnd ( ) + '\n```' ;
7+
8+ const renderSetting = ( block : string [ ] ) : string => {
9+ const assignment = block . find ( ( l ) => / ^ [ A - Z ] [ A - Z 0 - 9 _ ] * = / . test ( uncomment ( l ) ) ) ;
10+ if ( ! assignment ) throw Error ( 'could not find assignment ' + block ) ;
11+
12+ const name = uncomment ( assignment ) . split ( '=' ) [ 0 ] ;
13+ return [ '### ' + name , codeBlock ( block . join ( '\n' ) ) ] . join ( '\n\n' ) ;
14+ } ;
15+
16+ export default {
17+ async load ( ) {
18+ const res = await fetch ( SOURCE ) ;
19+ if ( ! res . ok ) throw Error ( 'could not fetch gotify-server.env.example' ) ;
20+
21+ const [ header , ...blocks ] = ( await res . text ( ) )
22+ . trimEnd ( )
23+ . split ( / \n * \n / )
24+ . map ( ( b ) => b . split ( '\n' ) )
25+ . filter ( ( b ) => b . some ( ( l ) => l . trim ( ) ) ) ;
26+
27+ const markdown = [
28+ codeBlock ( header . map ( uncomment ) . join ( '\n' ) ) ,
29+ ...blocks . map ( renderSetting ) ,
30+ ] . join ( '\n\n' ) ;
31+
32+ return ( await createMarkdownRenderer ( '.' ) ) . render ( markdown ) ;
33+ } ,
34+ } ;
Original file line number Diff line number Diff line change 11# Configuration
22
3+ <script setup >
4+ import {data as envExample } from ' ../config.data.ts'
5+ </script >
6+
7+ ::: details 3.x Config
8+
9+ Gotify 3.x is configured through environment variables, which can be loaded from
10+ an env file. [ ` gotify-server.env.example ` ] ( https://raw.githubusercontent.com/gotify/server/refs/heads/master/gotify-server.env.example )
11+
12+ <div v-html =" envExample " ></div >
13+
14+ :::
15+
16+ ::: details 2.x Config
17+
318gotify/server can be configured per config file and environment variables.
419When using docker it is recommended to use environment variables.
520
@@ -158,3 +173,5 @@ GOTIFY_OIDC_REDIRECTURL=http://gotify.example.org/auth/oidc/callback
158173GOTIFY_OIDC_AUTOREGISTER=true
159174GOTIFY_OIDC_USERNAMECLAIM=preferred_username
160175```
176+
177+ :::
You can’t perform that action at this time.
0 commit comments