mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
feat: add trusted proxies config value
This commit is contained in:
@@ -112,6 +112,7 @@ func init() {
|
|||||||
{"ldap-search-filter", "(uid=%s)", "LDAP search filter for user lookup."},
|
{"ldap-search-filter", "(uid=%s)", "LDAP search filter for user lookup."},
|
||||||
{"resources-dir", "/data/resources", "Path to a directory containing custom resources (e.g. background image)."},
|
{"resources-dir", "/data/resources", "Path to a directory containing custom resources (e.g. background image)."},
|
||||||
{"database-path", "/data/tinyauth.db", "Path to the Sqlite database file."},
|
{"database-path", "/data/tinyauth.db", "Path to the Sqlite database file."},
|
||||||
|
{"trusted-proxies", "", "Comma separated list of trusted proxies (IP addresses) for correct client IP detection and for header ACLs."},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, opt := range configOptions {
|
for _, opt := range configOptions {
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ func (app *BootstrapApp) Setup() error {
|
|||||||
|
|
||||||
// Create engine
|
// Create engine
|
||||||
engine := gin.New()
|
engine := gin.New()
|
||||||
|
engine.SetTrustedProxies(strings.Split(app.Config.TrustedProxies, ","))
|
||||||
|
|
||||||
if config.Version != "development" {
|
if config.Version != "development" {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ type Config struct {
|
|||||||
LdapSearchFilter string `mapstructure:"ldap-search-filter"`
|
LdapSearchFilter string `mapstructure:"ldap-search-filter"`
|
||||||
ResourcesDir string `mapstructure:"resources-dir"`
|
ResourcesDir string `mapstructure:"resources-dir"`
|
||||||
DatabasePath string `mapstructure:"database-path" validate:"required"`
|
DatabasePath string `mapstructure:"database-path" validate:"required"`
|
||||||
|
TrustedProxies string `mapstructure:"trusted-proxies"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// OAuth/OIDC config
|
// OAuth/OIDC config
|
||||||
|
|||||||
Reference in New Issue
Block a user