cmd: support changing path from well-known prefix, allow configuring full path
This commit is contained in:
@@ -80,7 +80,7 @@ func main() {
|
|||||||
|
|
||||||
templateTheme := flag.String("challenge-template-theme", opt.ChallengeTemplateOverrides["Theme"], "name of the challenge template theme to use (forgejo => [forgejo-auto, forgejo-dark, forgejo-light, gitea...])")
|
templateTheme := flag.String("challenge-template-theme", opt.ChallengeTemplateOverrides["Theme"], "name of the challenge template theme to use (forgejo => [forgejo-auto, forgejo-dark, forgejo-light, gitea...])")
|
||||||
|
|
||||||
packageName := flag.String("package-path", internalCmdName, "package name to expose in .well-known url path")
|
basePath := flag.String("path", "/.well-known/."+internalCmdName, "base path where to expose go-away package onto, challenges will be served from here")
|
||||||
|
|
||||||
jwtPrivateKeySeed := flag.String("jwt-private-key-seed", "", "Seed for the jwt private key, or on JWT_PRIVATE_KEY_SEED env. One be generated by passing \"generate\" as a value, follows RFC 8032 private key definition. Defaults to random")
|
jwtPrivateKeySeed := flag.String("jwt-private-key-seed", "", "Seed for the jwt private key, or on JWT_PRIVATE_KEY_SEED env. One be generated by passing \"generate\" as a value, follows RFC 8032 private key definition. Defaults to random")
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ func main() {
|
|||||||
Backends: createdBackends,
|
Backends: createdBackends,
|
||||||
MainName: internalMainName,
|
MainName: internalMainName,
|
||||||
MainVersion: internalMainVersion,
|
MainVersion: internalMainVersion,
|
||||||
PackageName: *packageName,
|
BasePath: *basePath,
|
||||||
PrivateKeySeed: seed,
|
PrivateKeySeed: seed,
|
||||||
ClientIpHeader: *clientIpHeader,
|
ClientIpHeader: *clientIpHeader,
|
||||||
BackendIpHeader: *backendIpHeader,
|
BackendIpHeader: *backendIpHeader,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type StateSettings struct {
|
|||||||
PrivateKeySeed []byte
|
PrivateKeySeed []byte
|
||||||
MainName string
|
MainName string
|
||||||
MainVersion string
|
MainVersion string
|
||||||
PackageName string
|
BasePath string
|
||||||
ClientIpHeader string
|
ClientIpHeader string
|
||||||
BackendIpHeader string
|
BackendIpHeader string
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ type Settings struct {
|
|||||||
ChallengeTemplate string `yaml:"challenge-template"`
|
ChallengeTemplate string `yaml:"challenge-template"`
|
||||||
|
|
||||||
// ChallengeTemplateOverrides Key/Value overrides for the current chosen template
|
// ChallengeTemplateOverrides Key/Value overrides for the current chosen template
|
||||||
// Replacements TODO:
|
|
||||||
// Path -> go-away path
|
|
||||||
ChallengeTemplateOverrides map[string]string `yaml:"challenge-template-overrides"`
|
ChallengeTemplateOverrides map[string]string `yaml:"challenge-template-overrides"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ func NewState(p policy.Policy, opt settings.Settings, settings policy.StateSetti
|
|||||||
return nil, fmt.Errorf("failed to initialize RADb client: %w", err)
|
return nil, fmt.Errorf("failed to initialize RADb client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
state.urlPath = "/.well-known/." + state.Settings().PackageName
|
state.urlPath = state.Settings().BasePath
|
||||||
|
|
||||||
// set a reasonable configuration for default http proxy if there is none
|
// set a reasonable configuration for default http proxy if there is none
|
||||||
for _, backend := range state.Settings().Backends {
|
for _, backend := range state.Settings().Backends {
|
||||||
|
|||||||
Reference in New Issue
Block a user