@@ -3,8 +3,16 @@ package config
33// Default configuration
44func NewDefaultConfiguration () * Config {
55 return & Config {
6- ResourcesDir : "./resources" ,
7- DatabasePath : "./tinyauth.db" ,
6+ Database : DatabaseConfig {
7+ Path : "./tinyauth.db" ,
8+ },
9+ Analytics : AnalyticsConfig {
10+ Enabled : true ,
11+ },
12+ Resources : ResourcesConfig {
13+ Enabled : true ,
14+ Path : "./resources" ,
15+ },
816 Server : ServerConfig {
917 Port : 3000 ,
1018 Address : "0.0.0.0" ,
@@ -19,6 +27,7 @@ func NewDefaultConfiguration() *Config {
1927 Title : "Tinyauth" ,
2028 ForgotPasswordMessage : "You can change your password by changing the configuration." ,
2129 BackgroundImage : "/background.jpg" ,
30+ WarningsEnabled : true ,
2231 },
2332 Ldap : LdapConfig {
2433 Insecure : false ,
@@ -68,20 +77,32 @@ var RedirectCookieName = "tinyauth-redirect"
6877// Main app config
6978
7079type Config struct {
71- AppURL string `description:"The base URL where the app is hosted." yaml:"appUrl"`
72- ResourcesDir string `description:"The directory where resources are stored." yaml:"resourcesDir"`
73- DatabasePath string `description:"The path to the database file." yaml:"databasePath"`
74- DisableAnalytics bool `description:"Disable analytics." yaml:"disableAnalytics"`
75- DisableResources bool `description:"Disable resources server." yaml:"disableResources"`
76- Server ServerConfig `description:"Server configuration." yaml:"server"`
77- Auth AuthConfig `description:"Authentication configuration." yaml:"auth"`
78- Apps map [string ]App `description:"Application ACLs configuration." yaml:"apps"`
79- OAuth OAuthConfig `description:"OAuth configuration." yaml:"oauth"`
80- OIDC OIDCConfig `description:"OIDC configuration." yaml:"oidc"`
81- UI UIConfig `description:"UI customization." yaml:"ui"`
82- Ldap LdapConfig `description:"LDAP configuration." yaml:"ldap"`
83- Experimental ExperimentalConfig `description:"Experimental features, use with caution." yaml:"experimental"`
84- Log LogConfig `description:"Logging configuration." yaml:"log"`
80+ AppURL string `description:"The base URL where the app is hosted." yaml:"appUrl"`
81+ Database DatabaseConfig `description:"Database configuration." yaml:"database"`
82+ Analytics AnalyticsConfig `description:"Analytics configuration." yaml:"analytics"`
83+ Resources ResourcesConfig `description:"Resources configuration." yaml:"resources"`
84+ Server ServerConfig `description:"Server configuration." yaml:"server"`
85+ Auth AuthConfig `description:"Authentication configuration." yaml:"auth"`
86+ Apps map [string ]App `description:"Application ACLs configuration." yaml:"apps"`
87+ OAuth OAuthConfig `description:"OAuth configuration." yaml:"oauth"`
88+ OIDC OIDCConfig `description:"OIDC configuration." yaml:"oidc"`
89+ UI UIConfig `description:"UI customization." yaml:"ui"`
90+ Ldap LdapConfig `description:"LDAP configuration." yaml:"ldap"`
91+ Experimental ExperimentalConfig `description:"Experimental features, use with caution." yaml:"experimental"`
92+ Log LogConfig `description:"Logging configuration." yaml:"log"`
93+ }
94+
95+ type DatabaseConfig struct {
96+ Path string `description:"The path to the database, including file name." yaml:"path"`
97+ }
98+
99+ type AnalyticsConfig struct {
100+ Enabled bool `description:"Enable periodic version information collection." yaml:"enabled"`
101+ }
102+
103+ type ResourcesConfig struct {
104+ Enabled bool `description:"Enable the resources server." yaml:"enabled"`
105+ Path string `description:"The directory where resources are stored." yaml:"path"`
85106}
86107
87108type ServerConfig struct {
@@ -114,16 +135,16 @@ type OAuthConfig struct {
114135}
115136
116137type OIDCConfig struct {
117- PrivateKeyPath string `description:"Path to the private key file." yaml:"privateKeyPath"`
118- PublicKeyPath string `description:"Path to the public key file." yaml:"publicKeyPath"`
138+ PrivateKeyPath string `description:"Path to the private key file, including file name ." yaml:"privateKeyPath"`
139+ PublicKeyPath string `description:"Path to the public key file, including file name ." yaml:"publicKeyPath"`
119140 Clients map [string ]OIDCClientConfig `description:"OIDC clients configuration." yaml:"clients"`
120141}
121142
122143type UIConfig struct {
123144 Title string `description:"The title of the UI." yaml:"title"`
124145 ForgotPasswordMessage string `description:"Message displayed on the forgot password page." yaml:"forgotPasswordMessage"`
125146 BackgroundImage string `description:"Path to the background image." yaml:"backgroundImage"`
126- DisableWarnings bool `description:"Disable UI warnings." yaml:"disableWarnings "`
147+ WarningsEnabled bool `description:"Enable UI warnings." yaml:"warningsEnabled "`
127148}
128149
129150type LdapConfig struct {
0 commit comments