ci: gen github tmpl locales and commitlint (#3759)

This adds several automatic generators for Authelia docs etc.
pull/3972/head
James Elliott 2022-09-16 14:21:05 +10:00 committed by GitHub
parent 15110b732a
commit 9c72bc8977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 2770 additions and 753 deletions

View File

@ -0,0 +1,138 @@
---
name: Bug Report
description: Report a bug
labels:
- type/bug/unconfirmed
- status/needs-triage
- priority/4-normal
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report. If you are unsure if this is actually a bug we generally recommend creating a [Question and Answer Discussion](https://github.com/authelia/authelia/discussions/new?category=q-a) first.
Please review the following requirements before submitting this issue type:
1. Please ensure you do not report security vulnerabilities via this method. See our [Security Policy](https://www.authelia.com/security-policy).
2. Please try to give as much information as possible for us to be able to reproduce the issue and provide a quick fix.
3. Please ensure an issue does not already exist for this potential bug.
4. Please only provide specific versions. Latest is not a version.
5. Please read the [Troubleshooting Sanitization](https://www.authelia.com/r/sanitize) reference guide if you plan on removing or adjusting any values for the logs or configuration files
- type: dropdown
id: version
attributes:
label: Version
description: What version(s) of Authelia can you reproduce this bug on?
multiple: true
options:
- v4.36.7
- v4.36.6
- v4.36.5
- v4.36.4
- v4.36.3
- v4.36.2
- v4.36.1
- v4.36.0
- v4.35.6
- v4.35.5
- v4.35.4
- v4.35.3
- v4.35.2
- v4.35.1
- v4.35.0
- v4.34.6
- v4.34.5
- v4.34.4
- v4.34.3
- v4.34.2
- v4.34.1
- v4.34.0
- v4.33.2
- v4.33.1
- v4.33.0
- v4.32.2
- v4.32.1
- v4.32.0
- v4.31.0
validations:
required: true
- type: dropdown
id: deployment
attributes:
label: Deployment Method
description: How are you deploying Authelia?
options:
- Docker
- Kubernetes
- Bare-metal
- Other
validations:
required: true
- type: dropdown
id: proxy
attributes:
label: Reverse Proxy
description: What reverse proxy are you using?
options:
- Caddy
- Traefik
- Envoy
- NGINX
- SWAG
- NGINX Proxy Manager
- HAProxy
validations:
required: true
- type: input
id: proxy-version
attributes:
label: Reverse Proxy Version
description: What is the version of your reverse proxy?
placeholder: x.x.x
validations:
required: false
- type: textarea
id: description
attributes:
label: Description
description: Describe the bug
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Describe how we can reproduce this issue
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: Provide the logs (the template will automatically put this content in a code block)
render: shell
validations:
required: false
- type: textarea
id: configuration
attributes:
label: Configuration
description: Provide the Authelia configuration file (the template will automatically put this content in a code block)
render: yaml
validations:
required: false
- type: textarea
id: expectations
attributes:
label: Expectations
description: Describe the desired or expected results
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Provide any relevant specification or other documentation if applicable
validations:
required: false
...

View File

@ -1,41 +0,0 @@
---
name: Bug Report
about: Use this template to report bugs other than security vulnerabilities
labels: Possible Bug
---
## Bug Report
<!--
1. IMPORTANT: Do not report security vulnerabilities via GitHub issues. Please click 'choose a different type' and see
the dedicated report a security vulnerability link.
2. Remember to customize the title above.
3. Replace the below sections (not this section) starting with <!- - and ending with - -> with relevant information,
making sure to remove the <!- - and - ->.
4. Sections that start with _N/A_ are optional, but if you populate them with values please remove the _N/A_.
-->
### Description
<!--
Describe the bug here.
-->
### Expected Behaviour
_N/A_
<!--
Describe the behaviour your expect here.
-->
### Reproduction Steps
_N/A_
<!--
1. Replace this step with your first step. Add additional steps below this.
-->
### Additional Information
_N/A_
<!--
This section is for relevant additional information like; logs, configurations, environment information, etc.
-->

View File

@ -1,6 +1,15 @@
---
blank_issues_enabled: false
contact_links:
- name: Idea
url: https://github.com/authelia/authelia/discussions/new?category=ideas
about: Submit an Idea for Voting
- name: Question
url: https://github.com/authelia/authelia/discussions/new?category=q-a
about: Ask a Question
- name: Discussion
url: https://github.com/authelia/authelia/discussions/new
about: Start a Discussion related to Ideas, Polls, Show and Tell, or General Topics
- name: Documentation
url: https://www.authelia.com/
about: Read the Documentation

View File

@ -0,0 +1,47 @@
---
name: Feature Request
description: Submit a Feature for Design which Has Been Submitted as an Idea and has been voted on
labels:
- type/feature
- status/needs-design
- priority/4-normal
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request. A feature request is created as issue for the purpose of tracking the design and implementation of a feature.
Please review the following requirements before submitting this issue type:
1. Ensure there are no other similar feature requests.
2. Make sure you've checked the [Documentation](https://www.authelia.com) doesn't clearly document the features existence already.
3. Consider creating an [Idea Discussion](https://github.com/authelia/authelia/discussions/new?category=ideas) which can be voted on instead if one doesn't exist.
- type: textarea
id: description
attributes:
label: Description
description: Describe the feature
validations:
required: true
- type: textarea
id: use-case
attributes:
label: Use Case
description: Provide a use case
validations:
required: true
- type: textarea
id: details
attributes:
label: Details
description: Describe the feature in detail
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Provide any relevant specification or other documentation if applicable
validations:
required: false
...

View File

@ -1,26 +0,0 @@
---
name: Feature Request
about: Use this template to request features
labels: Feature Request
---
## Feature Request
<!--
1. IMPORTANT: Do not report security vulnerabilities via GitHub issues. Please click 'choose a different type' and see the dedicated report a security vulnerability link.
2. Remember to customize the title above.
3. Replace the below sections (not this section) starting with <!- - and ending with - -> with relevant information,
making sure to remove the <!- - and - ->.
4. Sections that start with _N/A_ are optional, but if you populate them with values please remove the _N/A_.
-->
### Description
<!--
Describe the feature here.
-->
### Use Case
_N/A_
<!--
Describe the specific use case if it isn't clear or may not be clear from your feature description here.
-->

View File

@ -1,7 +0,0 @@
---
name: Miscellaneous
about: Use this template for everything other than feature requests, security vulnerabilities, or bug reports such as questions
---
<!--
IMPORTANT: Do not report security vulnerabilities via GitHub issues. Please click 'choose a different type' and see the dedicated report a security vulnerability link.
-->

View File

@ -6,7 +6,8 @@ ignore: |
internal/configuration/test_resources/config_bad_quoting.yml
web/pnpm-lock.yaml
web/node_modules/
.github/ISSUE_TEMPLATE/feature-request.yml
.github/ISSUE_TEMPLATE/bug-report.yml
rules:
document-end:
level: warning

View File

@ -1,36 +0,0 @@
package main
import (
"github.com/spf13/cobra"
)
func newAllCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "all",
Short: "Run all generators with default options",
RunE: allRunE,
DisableAutoGenTag: true,
}
return cmd
}
func allRunE(cmd *cobra.Command, args []string) (err error) {
for _, subCmd := range cmd.Parent().Commands() {
if subCmd == cmd || subCmd.Use == "completion" || subCmd.Use == "help [command]" {
continue
}
switch {
case subCmd.RunE != nil:
if err = subCmd.RunE(subCmd, args); err != nil {
return err
}
case subCmd.Run != nil:
subCmd.Run(subCmd, args)
}
}
return nil
}

View File

@ -1,34 +1,271 @@
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/mail"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"strings"
"time"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func newCodeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "code",
Use: cmdUseCode,
Short: "Generate code",
RunE: codeRunE,
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.AddCommand(newCodeKeysCmd())
cmd.AddCommand(newCodeKeysCmd(), newCodeScriptsCmd())
return cmd
}
func codeRunE(cmd *cobra.Command, args []string) (err error) {
for _, subCmd := range cmd.Commands() {
switch {
case subCmd.RunE != nil:
if err = subCmd.RunE(subCmd, args); err != nil {
return err
}
case subCmd.Run != nil:
subCmd.Run(subCmd, args)
}
func newCodeScriptsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseCodeScripts,
Short: "Generate the generated portion of the authelia-scripts command",
RunE: codeScriptsRunE,
DisableAutoGenTag: true,
}
return cmd
}
func newCodeKeysCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseKeys,
Short: "Generate the list of valid configuration keys",
RunE: codeKeysRunE,
DisableAutoGenTag: true,
}
return cmd
}
func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
var (
root, pathScriptsGen string
resp *http.Response
)
data := &tmplScriptsGEnData{}
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathScriptsGen, err = cmd.Flags().GetString(cmdFlagFileScriptsGen); err != nil {
return err
}
if data.Package, err = cmd.Flags().GetString(cmdFlagPackageScriptsGen); err != nil {
return err
}
if resp, err = http.Get("https://api.github.com/repos/swagger-api/swagger-ui/tags"); err != nil {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
}
defer resp.Body.Close()
var (
respJSON []GitHubTagsJSON
respRaw []byte
)
if respRaw, err = io.ReadAll(resp.Body); err != nil {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
}
if err = json.Unmarshal(respRaw, &respJSON); err != nil {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
}
if len(respJSON) < 1 {
return fmt.Errorf("failed to get latest version of the Swagger UI: the api returned zero results")
}
if strings.HasPrefix(respJSON[0].Name, "v") {
data.VersionSwaggerUI = respJSON[0].Name[1:]
} else {
data.VersionSwaggerUI = respJSON[0].Name
}
fullPathScriptsGen := filepath.Join(root, pathScriptsGen)
var f *os.File
if f, err = os.Create(fullPathScriptsGen); err != nil {
return fmt.Errorf("failed to create file '%s': %w", fullPathScriptsGen, err)
}
if err = tmplScriptsGen.Execute(f, data); err != nil {
_ = f.Close()
return fmt.Errorf("failed to write output file '%s': %w", fullPathScriptsGen, err)
}
if err = f.Close(); err != nil {
return fmt.Errorf("failed to close output file '%s': %w", fullPathScriptsGen, err)
}
return nil
}
// GitHubTagsJSON represents the JSON struct for the GitHub Tags API.
type GitHubTagsJSON struct {
Name string `json:"name"`
}
func codeKeysRunE(cmd *cobra.Command, args []string) (err error) {
var (
pathCodeConfigKeys, root string
f *os.File
)
data := tmplConfigurationKeysData{
Timestamp: time.Now(),
Keys: readTags("", reflect.TypeOf(schema.Configuration{})),
}
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathCodeConfigKeys, err = cmd.Flags().GetString(cmdFlagFileConfigKeys); err != nil {
return err
}
if data.Package, err = cmd.Flags().GetString(cmdFlagPackageConfigKeys); err != nil {
return err
}
fullPathCodeConfigKeys := filepath.Join(root, pathCodeConfigKeys)
if f, err = os.Create(fullPathCodeConfigKeys); err != nil {
return fmt.Errorf("failed to create file '%s': %w", fullPathCodeConfigKeys, err)
}
if err = tmplCodeConfigurationSchemaKeys.Execute(f, data); err != nil {
_ = f.Close()
return fmt.Errorf("failed to write output file '%s': %w", fullPathCodeConfigKeys, err)
}
if err = f.Close(); err != nil {
return fmt.Errorf("failed to close output file '%s': %w", fullPathCodeConfigKeys, err)
}
return nil
}
var decodedTypes = []reflect.Type{
reflect.TypeOf(mail.Address{}),
reflect.TypeOf(regexp.Regexp{}),
reflect.TypeOf(url.URL{}),
reflect.TypeOf(time.Duration(0)),
reflect.TypeOf(schema.Address{}),
}
func containsType(needle reflect.Type, haystack []reflect.Type) (contains bool) {
for _, t := range haystack {
if needle.Kind() == reflect.Ptr {
if needle.Elem() == t {
return true
}
} else if needle == t {
return true
}
}
return false
}
func readTags(prefix string, t reflect.Type) (tags []string) {
tags = make([]string, 0)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tag := field.Tag.Get("koanf")
if tag == "" {
tags = append(tags, prefix)
continue
}
switch field.Type.Kind() {
case reflect.Struct:
if !containsType(field.Type, decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, false), field.Type)...)
continue
}
case reflect.Slice:
if field.Type.Elem().Kind() == reflect.Struct {
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, getKeyNameFromTagAndPrefix(prefix, tag, false))
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, true), field.Type.Elem())...)
continue
}
}
case reflect.Ptr:
switch field.Type.Elem().Kind() {
case reflect.Struct:
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, false), field.Type.Elem())...)
continue
}
case reflect.Slice:
if field.Type.Elem().Elem().Kind() == reflect.Struct {
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, true), field.Type.Elem())...)
continue
}
}
}
}
tags = append(tags, getKeyNameFromTagAndPrefix(prefix, tag, false))
}
return tags
}
func getKeyNameFromTagAndPrefix(prefix, name string, slice bool) string {
nameParts := strings.SplitN(name, ",", 2)
if prefix == "" {
return nameParts[0]
}
if len(nameParts) == 2 && nameParts[1] == "squash" {
return prefix
}
if slice {
return fmt.Sprintf("%s.%s[]", prefix, nameParts[0])
}
return fmt.Sprintf("%s.%s", prefix, nameParts[0])
}

View File

@ -1,173 +0,0 @@
package main
import (
"fmt"
"net/mail"
"net/url"
"os"
"reflect"
"regexp"
"strings"
"text/template"
"time"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func newCodeKeysCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "keys",
Short: "Generate the list of valid configuration keys",
RunE: codeKeysRunE,
DisableAutoGenTag: true,
}
cmd.Flags().StringP("file", "f", "./internal/configuration/schema/keys.go", "Sets the path of the keys file")
cmd.Flags().String("package", "schema", "Sets the package name of the keys file")
return cmd
}
func codeKeysRunE(cmd *cobra.Command, args []string) (err error) {
var (
file string
f *os.File
)
data := keysTemplateStruct{
Timestamp: time.Now(),
Keys: readTags("", reflect.TypeOf(schema.Configuration{})),
}
if file, err = cmd.Flags().GetString("file"); err != nil {
return err
}
if data.Package, err = cmd.Flags().GetString("package"); err != nil {
return err
}
if f, err = os.Create(file); err != nil {
return fmt.Errorf("failed to create file '%s': %w", file, err)
}
var (
content []byte
tmpl *template.Template
)
if content, err = templatesFS.ReadFile("templates/config_keys.go.tmpl"); err != nil {
return err
}
if tmpl, err = template.New("keys").Parse(string(content)); err != nil {
return err
}
return tmpl.Execute(f, data)
}
type keysTemplateStruct struct {
Timestamp time.Time
Keys []string
Package string
}
var decodedTypes = []reflect.Type{
reflect.TypeOf(mail.Address{}),
reflect.TypeOf(regexp.Regexp{}),
reflect.TypeOf(url.URL{}),
reflect.TypeOf(time.Duration(0)),
reflect.TypeOf(schema.Address{}),
}
func containsType(needle reflect.Type, haystack []reflect.Type) (contains bool) {
for _, t := range haystack {
if needle.Kind() == reflect.Ptr {
if needle.Elem() == t {
return true
}
} else if needle == t {
return true
}
}
return false
}
func readTags(prefix string, t reflect.Type) (tags []string) {
tags = make([]string, 0)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tag := field.Tag.Get("koanf")
if tag == "" {
tags = append(tags, prefix)
continue
}
switch field.Type.Kind() {
case reflect.Struct:
if !containsType(field.Type, decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, false), field.Type)...)
continue
}
case reflect.Slice:
if field.Type.Elem().Kind() == reflect.Struct {
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, getKeyNameFromTagAndPrefix(prefix, tag, false))
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, true), field.Type.Elem())...)
continue
}
}
case reflect.Ptr:
switch field.Type.Elem().Kind() {
case reflect.Struct:
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, false), field.Type.Elem())...)
continue
}
case reflect.Slice:
if field.Type.Elem().Elem().Kind() == reflect.Struct {
if !containsType(field.Type.Elem(), decodedTypes) {
tags = append(tags, readTags(getKeyNameFromTagAndPrefix(prefix, tag, true), field.Type.Elem())...)
continue
}
}
}
}
tags = append(tags, getKeyNameFromTagAndPrefix(prefix, tag, false))
}
return tags
}
func getKeyNameFromTagAndPrefix(prefix, name string, slice bool) string {
nameParts := strings.SplitN(name, ",", 2)
if prefix == "" {
return nameParts[0]
}
if len(nameParts) == 2 && nameParts[1] == "squash" {
return prefix
}
if slice {
return fmt.Sprintf("%s.%s[]", prefix, nameParts[0])
}
return fmt.Sprintf("%s.%s", prefix, nameParts[0])
}

View File

@ -0,0 +1,220 @@
package main
import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/spf13/cobra"
)
// CommitMessageTmpl is a template data structure which is used to generate files with commit message information.
type CommitMessageTmpl struct {
Scopes ScopesTmpl
Types TypesTmpl
}
// TypesTmpl is a template data structure which is used to generate files with commit message types.
type TypesTmpl struct {
List []string
Details []NameDescriptionTmpl
}
// ScopesTmpl is a template data structure which is used to generate files with commit message scopes.
type ScopesTmpl struct {
All []string
Packages []string
Extra []NameDescriptionTmpl
}
// NameDescriptionTmpl is a template item which includes a name, description and list of scopes.
type NameDescriptionTmpl struct {
Name string
Description string
Scopes []string
}
func newCommitLintCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseCommitLint,
Short: "Generate commit lint files",
RunE: commitLintRunE,
DisableAutoGenTag: true,
}
return cmd
}
var commitScopesExtra = []NameDescriptionTmpl{
{"api", "used for changes that change the openapi specification", nil},
{"cmd", "used for changes to the `%s` top level binaries", nil},
{"web", "used for changes to the React based frontend", nil},
}
var commitTypes = []NameDescriptionTmpl{
{"build", "Changes that affect the build system or external dependencies", []string{"bundler", "deps", "docker", "go", "npm"}},
{"ci", "Changes to our CI configuration files and scripts", []string{"autheliabot", "buildkite", "codecov", "golangci-lint", "renovate", "reviewdog"}},
{"docs", "Documentation only changes", nil},
{"feat", "A new feature", nil},
{"fix", "A bug fix", nil},
{"i18n", "Updating translations or internationalization settings", nil},
{"perf", "A code change that improves performance", nil},
{"refactor", "A code change that neither fixes a bug nor adds a feature", nil},
{"release", "Releasing a new version of Authelia", nil},
{"test", "Adding missing tests or correcting existing tests", nil},
}
var commitTypesExtra = []string{"revert"}
func getGoPackages(dir string) (pkgs []string, err error) {
var (
entries []os.DirEntry
entriesSub []os.DirEntry
)
if entries, err = os.ReadDir(dir); err != nil {
return nil, fmt.Errorf("failed to detect go packages in directory '%s': %w", dir, err)
}
for _, entry := range entries {
if !entry.IsDir() {
continue
}
if entriesSub, err = os.ReadDir(filepath.Join(dir, entry.Name())); err != nil {
continue
}
for _, entrySub := range entriesSub {
if entrySub.IsDir() {
continue
}
if strings.HasSuffix(entrySub.Name(), ".go") {
pkgs = append(pkgs, entry.Name())
break
}
}
}
return pkgs, nil
}
func commitLintRunE(cmd *cobra.Command, args []string) (err error) {
var root, pathCommitLintConfig, pathDocsCommitMessageGuidelines string
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathCommitLintConfig, err = cmd.Flags().GetString(cmdFlagFileConfigCommitLint); err != nil {
return err
}
if pathDocsCommitMessageGuidelines, err = cmd.Flags().GetString(cmdFlagFileDocsCommitMsgGuidelines); err != nil {
return err
}
data := &CommitMessageTmpl{
Scopes: ScopesTmpl{
All: []string{},
Packages: []string{},
Extra: []NameDescriptionTmpl{},
},
Types: TypesTmpl{
List: []string{},
Details: []NameDescriptionTmpl{},
},
}
var (
cmds []string
pkgs []string
)
if cmds, err = getGoPackages(filepath.Join(root, subPathCmd)); err != nil {
return err
}
if pkgs, err = getGoPackages(filepath.Join(root, subPathInternal)); err != nil {
return err
}
data.Scopes.All = append(data.Scopes.All, pkgs...)
data.Scopes.Packages = append(data.Scopes.Packages, pkgs...)
for _, scope := range commitScopesExtra {
switch scope.Name {
case subPathCmd:
data.Scopes.Extra = append(data.Scopes.Extra, NameDescriptionTmpl{Name: scope.Name, Description: fmt.Sprintf(scope.Description, strings.Join(cmds, "|"))})
default:
data.Scopes.Extra = append(data.Scopes.Extra, scope)
}
data.Scopes.All = append(data.Scopes.All, scope.Name)
}
for _, cType := range commitTypes {
data.Types.List = append(data.Types.List, cType.Name)
data.Types.Details = append(data.Types.Details, cType)
data.Scopes.All = append(data.Scopes.All, cType.Scopes...)
}
data.Types.List = append(data.Types.List, commitTypesExtra...)
sort.Slice(data.Scopes.All, func(i, j int) bool {
return data.Scopes.All[i] < data.Scopes.All[j]
})
sort.Slice(data.Scopes.Packages, func(i, j int) bool {
return data.Scopes.Packages[i] < data.Scopes.Packages[j]
})
sort.Slice(data.Scopes.Extra, func(i, j int) bool {
return data.Scopes.Extra[i].Name < data.Scopes.Extra[j].Name
})
sort.Slice(data.Types.List, func(i, j int) bool {
return data.Types.List[i] < data.Types.List[j]
})
sort.Slice(data.Types.Details, func(i, j int) bool {
return data.Types.Details[i].Name < data.Types.Details[j].Name
})
var f *os.File
fullPathCommitLintConfig := filepath.Join(root, pathCommitLintConfig)
if f, err = os.Create(fullPathCommitLintConfig); err != nil {
return fmt.Errorf("failed to create output file '%s': %w", fullPathCommitLintConfig, err)
}
if err = tmplDotCommitLintRC.Execute(f, data); err != nil {
return fmt.Errorf("failed to write output file '%s': %w", fullPathCommitLintConfig, err)
}
if err = f.Close(); err != nil {
return fmt.Errorf("failed to close output file '%s': %w", fullPathCommitLintConfig, err)
}
fullPathDocsCommitMessageGuidelines := filepath.Join(root, pathDocsCommitMessageGuidelines)
if f, err = os.Create(fullPathDocsCommitMessageGuidelines); err != nil {
return fmt.Errorf("failed to create output file '%s': %w", fullPathDocsCommitMessageGuidelines, err)
}
if err = tmplDocsCommitMessageGuidelines.Execute(f, data); err != nil {
return fmt.Errorf("failed to write output file '%s': %w", fullPathDocsCommitMessageGuidelines, err)
}
if err = f.Close(); err != nil {
return fmt.Errorf("failed to close output file '%s': %w", fullPathDocsCommitMessageGuidelines, err)
}
return nil
}

View File

@ -6,30 +6,14 @@ import (
func newDocsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "docs",
Use: cmdUseDocs,
Short: "Generate docs",
RunE: docsRunE,
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.PersistentFlags().StringP("cwd", "C", "", "Sets the CWD for git commands")
cmd.AddCommand(newDocsCLICmd(), newDocsDateCmd())
cmd.AddCommand(newDocsCLICmd(), newDocsDateCmd(), newDocsKeysCmd())
return cmd
}
func docsRunE(cmd *cobra.Command, args []string) (err error) {
for _, subCmd := range cmd.Commands() {
switch {
case subCmd.RunE != nil:
if err = subCmd.RunE(subCmd, args); err != nil {
return err
}
case subCmd.Run != nil:
subCmd.Run(subCmd, args)
}
}
return nil
}

View File

@ -16,52 +16,56 @@ import (
func newDocsCLICmd() *cobra.Command {
cmd := &cobra.Command{
Use: "cli",
Use: cmdUseDocsCLI,
Short: "Generate CLI docs",
RunE: docsCLIRunE,
DisableAutoGenTag: true,
}
cmd.Flags().StringP("directory", "d", "./docs/content/en/reference/cli", "The directory to store the markdown in")
return cmd
}
func docsCLIRunE(cmd *cobra.Command, args []string) (err error) {
var root string
var root, pathDocsCLIReference string
if root, err = cmd.Flags().GetString("directory"); err != nil {
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if err = os.MkdirAll(root, 0775); err != nil {
if pathDocsCLIReference, err = cmd.Flags().GetString(cmdFlagDocsCLIReference); err != nil {
return err
}
fullPathDocsCLIReference := filepath.Join(root, pathDocsCLIReference)
if err = os.MkdirAll(fullPathDocsCLIReference, 0775); err != nil {
if !os.IsExist(err) {
return err
}
}
if err = genCLIDoc(commands.NewRootCmd(), filepath.Join(root, "authelia")); err != nil {
if err = genCLIDoc(commands.NewRootCmd(), filepath.Join(fullPathDocsCLIReference, "authelia")); err != nil {
return err
}
if err = genCLIDocWriteIndex(root, "authelia"); err != nil {
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, "authelia"); err != nil {
return err
}
if err = genCLIDoc(cmdscripts.NewRootCmd(), filepath.Join(root, "authelia-scripts")); err != nil {
if err = genCLIDoc(cmdscripts.NewRootCmd(), filepath.Join(fullPathDocsCLIReference, "authelia-scripts")); err != nil {
return err
}
if err = genCLIDocWriteIndex(root, "authelia-scripts"); err != nil {
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, "authelia-scripts"); err != nil {
return err
}
if err = genCLIDoc(newRootCmd(), filepath.Join(root, "authelia-gen")); err != nil {
if err = genCLIDoc(newRootCmd(), filepath.Join(fullPathDocsCLIReference, cmdUseRoot)); err != nil {
return err
}
if err = genCLIDocWriteIndex(root, "authelia-gen"); err != nil {
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, cmdUseRoot); err != nil {
return err
}
@ -69,6 +73,16 @@ func docsCLIRunE(cmd *cobra.Command, args []string) (err error) {
}
func genCLIDoc(cmd *cobra.Command, path string) (err error) {
if _, err = os.Stat(path); err != nil && !os.IsNotExist(err) {
return err
}
if err == nil || !os.IsNotExist(err) {
if err = os.RemoveAll(path); err != nil {
return fmt.Errorf("failed to remove docs: %w", err)
}
}
if err = os.Mkdir(path, 0755); err != nil {
if !os.IsExist(err) {
return err

View File

@ -17,14 +17,13 @@ import (
func newDocsDateCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "date",
Use: cmdUseDocsDate,
Short: "Generate doc dates",
RunE: docsDateRunE,
DisableAutoGenTag: true,
}
cmd.Flags().StringP("directory", "d", "./docs/content", "The directory to modify")
cmd.Flags().String("commit-until", "HEAD", "The commit to check the logs until")
cmd.Flags().String("commit-since", "", "The commit to check the logs since")
@ -33,14 +32,18 @@ func newDocsDateCmd() *cobra.Command {
func docsDateRunE(cmd *cobra.Command, args []string) (err error) {
var (
dir, cwd, commitUtil, commitSince, commitFilter string
root, pathDocsContent, cwd, commitUtil, commitSince, commitFilter string
)
if dir, err = cmd.Flags().GetString("directory"); err != nil {
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if cwd, err = cmd.Flags().GetString("cwd"); err != nil {
if pathDocsContent, err = cmd.Flags().GetString(cmdFlagDocsContent); err != nil {
return err
}
if cwd, err = cmd.Flags().GetString(cmdFlagCwd); err != nil {
return err
}
@ -56,7 +59,7 @@ func docsDateRunE(cmd *cobra.Command, args []string) (err error) {
commitFilter = fmt.Sprintf("%s...%s", commitUtil, commitSince)
}
return filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error {
return filepath.Walk(filepath.Join(root, pathDocsContent), func(path string, info fs.FileInfo, err error) error {
if err != nil {
return err
}
@ -163,7 +166,7 @@ func replaceDates(path string, date time.Time, dateGit *time.Time) {
for scanner.Scan() {
if found < 2 && frontmatter < 2 {
switch {
case scanner.Text() == frontmatterDelimiterLine:
case scanner.Text() == delimiterLineFrontMatter:
buf.Write(scanner.Bytes())
frontmatter++
case frontmatter != 0 && strings.HasPrefix(scanner.Text(), "date: "):
@ -207,13 +210,13 @@ func getFrontmatter(path string) []byte {
for scanner.Scan() {
if start {
if scanner.Text() == frontmatterDelimiterLine {
if scanner.Text() == delimiterLineFrontMatter {
break
}
buf.Write(scanner.Bytes())
buf.Write(newline)
} else if scanner.Text() == frontmatterDelimiterLine {
} else if scanner.Text() == delimiterLineFrontMatter {
start = true
}
}

View File

@ -0,0 +1,81 @@
package main
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"reflect"
"strings"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/configuration"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func newDocsKeysCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseKeys,
Short: "Generate the docs data file for configuration keys",
RunE: docsKeysRunE,
DisableAutoGenTag: true,
}
return cmd
}
func docsKeysRunE(cmd *cobra.Command, args []string) (err error) {
//nolint:prealloc
var (
pathDocsConfigKeys, root string
data []ConfigurationKey
)
keys := readTags("", reflect.TypeOf(schema.Configuration{}))
for _, key := range keys {
if strings.Contains(key, "[]") {
continue
}
ck := ConfigurationKey{
Path: key,
Secret: configuration.IsSecretKey(key),
}
switch {
case ck.Secret:
ck.Env = configuration.ToEnvironmentSecretKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
default:
ck.Env = configuration.ToEnvironmentKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
}
data = append(data, ck)
}
var (
dataJSON []byte
)
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathDocsConfigKeys, err = cmd.Flags().GetString(cmdFlagFileDocsKeys); err != nil {
return err
}
fullPathDocsConfigKeys := filepath.Join(root, pathDocsConfigKeys)
if dataJSON, err = json.Marshal(data); err != nil {
return err
}
if err = os.WriteFile(fullPathDocsConfigKeys, dataJSON, 0600); err != nil {
return fmt.Errorf("failed to write file '%s': %w", fullPathDocsConfigKeys, err)
}
return nil
}

View File

@ -0,0 +1,236 @@
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"github.com/spf13/cobra"
)
func newGitHubCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseGitHub,
Short: "Generate GitHub files",
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.AddCommand(newGitHubIssueTemplatesCmd())
return cmd
}
func newGitHubIssueTemplatesCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseGitHubIssueTemplates,
Short: "Generate GitHub issue templates",
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.AddCommand(newGitHubIssueTemplatesBugReportCmd(), newGitHubIssueTemplatesFeatureCmd())
return cmd
}
func newGitHubIssueTemplatesFeatureCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseGitHubIssueTemplatesFR,
Short: "Generate GitHub feature request issue template",
RunE: cmdGitHubIssueTemplatesFeatureRunE,
DisableAutoGenTag: true,
}
return cmd
}
func newGitHubIssueTemplatesBugReportCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseGitHubIssueTemplatesBR,
Short: "Generate GitHub bug report issue template",
RunE: cmdGitHubIssueTemplatesBugReportRunE,
DisableAutoGenTag: true,
}
return cmd
}
func cmdGitHubIssueTemplatesFeatureRunE(cmd *cobra.Command, args []string) (err error) {
var (
cwd, file, root string
tags, tagsFuture []string
latestMajor, latestMinor, latestPatch, versions int
)
if cwd, err = cmd.Flags().GetString(cmdFlagCwd); err != nil {
return err
}
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if file, err = cmd.Flags().GetString(cmdFlagFeatureRequest); err != nil {
return err
}
if versions, err = cmd.Flags().GetInt(cmdFlagVersions); err != nil {
return err
}
if tags, err = getGitTags(cwd); err != nil {
return err
}
latest := tags[0]
if _, err = fmt.Sscanf(latest, "v%d.%d.%d", &latestMajor, &latestMinor, &latestPatch); err != nil {
return fmt.Errorf("error occurred parsing version as semver: %w", err)
}
var (
minor int
)
for minor = latestMinor + 1; minor < latestMinor+versions; minor++ {
tagsFuture = append(tagsFuture, fmt.Sprintf("v%d.%d.0", latestMajor, minor))
}
tagsFuture = append(tagsFuture, fmt.Sprintf("v%d.0.0", latestMajor+1))
var (
f *os.File
)
fullPath := filepath.Join(root, file)
if f, err = os.Create(fullPath); err != nil {
return fmt.Errorf("failed to create file '%s': %w", fullPath, err)
}
data := &tmplIssueTemplateData{
Labels: []string{labelTypeFeature.String(), labelStatusNeedsDesign.String(), labelPriorityNormal.String()},
Versions: tagsFuture,
}
if err = tmplIssueTemplateFeature.Execute(f, data); err != nil {
return err
}
return nil
}
func cmdGitHubIssueTemplatesBugReportRunE(cmd *cobra.Command, args []string) (err error) {
var (
cwd, file, dirRoot string
latestMinor, versions int
tags []string
)
if cwd, err = cmd.Flags().GetString(cmdFlagCwd); err != nil {
return err
}
if dirRoot, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if file, err = cmd.Flags().GetString(cmdFlagBugReport); err != nil {
return err
}
if versions, err = cmd.Flags().GetInt(cmdFlagVersions); err != nil {
return err
}
if tags, err = getGitTags(cwd); err != nil {
return err
}
latest := tags[0]
latestParts := strings.Split(latest, ".")
if len(latestParts) < 2 {
return fmt.Errorf("error extracting latest minor version from tag: %s does not appear to be a semver", latest)
}
if latestMinor, err = strconv.Atoi(latestParts[1]); err != nil {
return fmt.Errorf("error extracting latest minor version from tag: %w", err)
}
//nolint:prealloc
var (
tagsRecent []string
parts []string
minor int
)
for _, tag := range tags {
if parts = strings.Split(tag, "."); len(parts) < 2 {
return fmt.Errorf("error extracting minor version from tag: %s does not appear to be a semver", tag)
}
if minor, err = strconv.Atoi(parts[1]); err != nil {
return fmt.Errorf("error extracting minor version from tag: %w", err)
}
if minor < latestMinor-versions {
break
}
tagsRecent = append(tagsRecent, tag)
}
var (
f *os.File
)
fullPath := filepath.Join(dirRoot, file)
if f, err = os.Create(fullPath); err != nil {
return fmt.Errorf("failed to create file '%s': %w", fullPath, err)
}
data := &tmplIssueTemplateData{
Labels: []string{labelTypeBugUnconfirmed.String(), labelStatusNeedsTriage.String(), labelPriorityNormal.String()},
Versions: tagsRecent,
Proxies: []string{"Caddy", "Traefik", "Envoy", "NGINX", "SWAG", "NGINX Proxy Manager", "HAProxy"},
}
if err = tmplGitHubIssueTemplateBug.Execute(f, data); err != nil {
return err
}
return nil
}
func getGitTags(cwd string) (tags []string, err error) {
var (
args []string
tagsOutput []byte
)
if len(cwd) != 0 {
args = append(args, "-C", cwd)
}
args = append(args, "tag", "--sort=-creatordate")
cmd := exec.Command("git", args...)
if tagsOutput, err = cmd.Output(); err != nil {
return nil, err
}
return strings.Split(string(tagsOutput), "\n"), nil
}

View File

@ -0,0 +1,215 @@
package main
import (
"encoding/json"
"fmt"
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"github.com/spf13/cobra"
"golang.org/x/text/language"
"golang.org/x/text/language/display"
"github.com/authelia/authelia/v4/internal/utils"
)
func newLocalesCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseLocales,
Short: "Generate locales files",
RunE: localesRunE,
DisableAutoGenTag: true,
}
return cmd
}
func localesRunE(cmd *cobra.Command, args []string) (err error) {
var (
root, pathLocales string
pathWebI18NIndex, pathDocsDataLanguages string
)
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathLocales, err = cmd.Flags().GetString(cmdFlagDirLocales); err != nil {
return err
}
if pathWebI18NIndex, err = cmd.Flags().GetString(cmdFlagFileWebI18N); err != nil {
return err
}
if pathDocsDataLanguages, err = cmd.Flags().GetString(cmdFlagDocsDataLanguages); err != nil {
return err
}
data, err := getLanguages(filepath.Join(root, pathLocales))
if err != nil {
return err
}
fullPathWebI18NIndex := filepath.Join(root, pathWebI18NIndex)
var (
f *os.File
dataJSON []byte
)
if f, err = os.Create(fullPathWebI18NIndex); err != nil {
return fmt.Errorf("failed to create file '%s': %w", fullPathWebI18NIndex, err)
}
if err = tmplWebI18NIndex.Execute(f, data); err != nil {
return err
}
if dataJSON, err = json.Marshal(data); err != nil {
return err
}
fullPathDocsDataLanguages := filepath.Join(root, pathDocsDataLanguages)
if err = os.WriteFile(fullPathDocsDataLanguages, dataJSON, 0600); err != nil {
return fmt.Errorf("failed to write file '%s': %w", fullPathDocsDataLanguages, err)
}
return nil
}
//nolint:gocyclo
func getLanguages(dir string) (languages *Languages, err error) {
//nolint:prealloc
var locales []string
languages = &Languages{
Defaults: DefaultsLanguages{
Namespace: localeNamespaceDefault,
},
}
var defaultTag language.Tag
if defaultTag, err = language.Parse(localeDefault); err != nil {
return nil, fmt.Errorf("failed to parse default language: %w", err)
}
languages.Defaults.Language = Language{
Display: display.English.Tags().Name(defaultTag),
Locale: localeDefault,
}
if err = filepath.Walk(dir, func(path string, info fs.FileInfo, errWalk error) (err error) {
if errWalk != nil {
return errWalk
}
nameLower := strings.ToLower(info.Name())
ext := filepath.Ext(nameLower)
ns := strings.Replace(nameLower, ext, "", 1)
if ext != ".json" {
return nil
}
if !utils.IsStringInSlice(ns, languages.Namespaces) {
languages.Namespaces = append(languages.Namespaces, ns)
}
fdir, _ := filepath.Split(path)
locale := filepath.Base(fdir)
if utils.IsStringInSlice(locale, locales) {
for i, l := range languages.Languages {
if l.Locale == locale {
if utils.IsStringInSlice(ns, languages.Languages[i].Namespaces) {
break
}
languages.Languages[i].Namespaces = append(languages.Languages[i].Namespaces, ns)
break
}
}
return nil
}
var localeReal string
parts := strings.SplitN(locale, "-", 2)
if len(parts) == 2 && strings.EqualFold(parts[0], parts[1]) {
localeReal = parts[0]
} else {
localeReal = locale
}
var tag language.Tag
if tag, err = language.Parse(localeReal); err != nil {
return fmt.Errorf("failed to parse language '%s': %w", localeReal, err)
}
l := Language{
Display: display.English.Tags().Name(tag),
Locale: localeReal,
Namespaces: []string{ns},
Fallbacks: []string{languages.Defaults.Language.Locale},
Tag: tag,
}
languages.Languages = append(languages.Languages, l)
locales = append(locales, l.Locale)
return nil
}); err != nil {
return nil, err
}
var langs []Language //nolint:prealloc
for i, lang := range languages.Languages {
p := lang.Tag.Parent()
if p.String() == "und" || strings.Contains(p.String(), "-") {
continue
}
if utils.IsStringInSlice(p.String(), locales) {
continue
}
if p.String() != lang.Locale {
lang.Fallbacks = append([]string{p.String()}, lang.Fallbacks...)
}
languages.Languages[i] = lang
l := Language{
Display: display.English.Tags().Name(p),
Locale: p.String(),
Namespaces: lang.Namespaces,
Fallbacks: []string{languages.Defaults.Language.Locale},
Tag: p,
}
langs = append(langs, l)
locales = append(locales, l.Locale)
}
languages.Languages = append(languages.Languages, langs...)
sort.Slice(languages.Languages, func(i, j int) bool {
return languages.Languages[i].Locale == localeDefault || languages.Languages[i].Locale < languages.Languages[j].Locale
})
return languages, nil
}

View File

@ -0,0 +1,124 @@
package main
import (
"sort"
"strings"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/utils"
)
var rootCmd *cobra.Command
func init() {
rootCmd = newRootCmd()
}
func newRootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseRoot,
Short: "Authelia's generator tooling",
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.PersistentFlags().StringP(cmdFlagCwd, "C", "", "Sets the CWD for git commands")
cmd.PersistentFlags().StringP(cmdFlagRoot, "d", dirCurrent, "The repository root")
cmd.PersistentFlags().StringSliceP(cmdFlagExclude, "X", nil, "Sets the names of excluded generators")
cmd.PersistentFlags().String(cmdFlagFeatureRequest, fileGitHubIssueTemplateFR, "Sets the path of the feature request issue template file")
cmd.PersistentFlags().String(cmdFlagBugReport, fileGitHubIssueTemplateBR, "Sets the path of the bug report issue template file")
cmd.PersistentFlags().Int(cmdFlagVersions, 5, "the maximum number of minor versions to list in output templates")
cmd.PersistentFlags().String(cmdFlagDirLocales, dirLocales, "The locales directory in relation to the root")
cmd.PersistentFlags().String(cmdFlagFileWebI18N, fileWebI18NIndex, "The i18n typescript configuration file in relation to the root")
cmd.PersistentFlags().String(cmdFlagDocsDataLanguages, fileDocsDataLanguages, "The languages docs data file in relation to the docs data folder")
cmd.PersistentFlags().String(cmdFlagDocsCLIReference, dirDocsCLIReference, "The directory to store the markdown in")
cmd.PersistentFlags().String(cmdFlagDocsContent, dirDocsContent, "The directory with the docs content")
cmd.PersistentFlags().String(cmdFlagFileConfigKeys, fileCodeConfigKeys, "Sets the path of the keys file")
cmd.PersistentFlags().String(cmdFlagFileDocsKeys, fileDocsConfigKeys, "Sets the path of the docs keys file")
cmd.PersistentFlags().String(cmdFlagPackageConfigKeys, pkgConfigSchema, "Sets the package name of the keys file")
cmd.PersistentFlags().String(cmdFlagFileScriptsGen, fileScriptsGen, "Sets the path of the authelia-scripts gen file")
cmd.PersistentFlags().String(cmdFlagPackageScriptsGen, pkgScriptsGen, "Sets the package name of the authelia-scripts gen file")
cmd.PersistentFlags().String(cmdFlagFileConfigCommitLint, fileCICommitLintConfig, "The commit lint javascript configuration file in relation to the root")
cmd.PersistentFlags().String(cmdFlagFileDocsCommitMsgGuidelines, fileDocsCommitMessageGuidelines, "The commit message guidelines documentation file in relation to the root")
cmd.AddCommand(newCodeCmd(), newDocsCmd(), newGitHubCmd(), newLocalesCmd(), newCommitLintCmd())
return cmd
}
func rootSubCommandsRunE(cmd *cobra.Command, args []string) (err error) {
var exclude []string
if exclude, err = cmd.Flags().GetStringSlice(cmdFlagExclude); err != nil {
return err
}
subCmds := cmd.Commands()
switch cmd.Use {
case cmdUseRoot:
sort.Slice(subCmds, func(i, j int) bool {
switch subCmds[j].Use {
case cmdUseDocs:
// Ensure `docs` subCmd is last.
return true
default:
return subCmds[i].Use < subCmds[j].Use
}
})
case cmdUseDocs:
sort.Slice(subCmds, func(i, j int) bool {
switch subCmds[j].Use {
case cmdUseDocsDate:
// Ensure `date` subCmd is last.
return true
default:
return subCmds[i].Use < subCmds[j].Use
}
})
default:
sort.Slice(subCmds, func(i, j int) bool {
return subCmds[i].Use < subCmds[j].Use
})
}
for _, subCmd := range subCmds {
if subCmd.Use == cmdUseCompletion || strings.HasPrefix(subCmd.Use, "help ") || utils.IsStringSliceContainsAny([]string{resolveCmdName(subCmd), subCmd.Use}, exclude) {
continue
}
rootCmd.SetArgs(rootCmdGetArgs(subCmd, args))
if err = rootCmd.Execute(); err != nil {
return err
}
}
return nil
}
func resolveCmdName(cmd *cobra.Command) string {
parent := cmd.Parent()
if parent != nil && parent.Use != cmd.Use && parent.Use != cmdUseRoot {
return resolveCmdName(parent) + "." + cmd.Use
}
return cmd.Use
}
func rootCmdGetArgs(cmd *cobra.Command, args []string) []string {
for {
if cmd == rootCmd {
break
}
args = append([]string{cmd.Use}, args...)
cmd = cmd.Parent()
}
return args
}

View File

@ -1,7 +1,81 @@
package main
const (
dateFmtRFC2822 = "Mon, _2 Jan 2006 15:04:05 -0700"
dateFmtYAML = "2006-01-02T15:04:05-07:00"
frontmatterDelimiterLine = "---"
dirCurrent = "./"
dirLocales = "internal/server/locales"
subPathCmd = "cmd"
subPathInternal = "internal"
fileCICommitLintConfig = "web/.commitlintrc.js"
fileWebI18NIndex = "web/src/i18n/index.ts"
fileDocsCommitMessageGuidelines = "docs/content/en/contributing/development/guidelines-commit-message.md"
fileDocsConfigKeys = "docs/data/configkeys.json"
fileCodeConfigKeys = "internal/configuration/schema/keys.go"
fileScriptsGen = "cmd/authelia-scripts/cmd/gen.go"
dirDocsContent = "docs/content"
dirDocsCLIReference = dirDocsContent + "/en/reference/cli"
fileDocsDataLanguages = "docs/data/languages.json"
fileGitHubIssueTemplateFR = ".github/ISSUE_TEMPLATE/feature-request.yml"
fileGitHubIssueTemplateBR = ".github/ISSUE_TEMPLATE/bug-report.yml"
)
const (
dateFmtRFC2822 = "Mon, _2 Jan 2006 15:04:05 -0700"
dateFmtYAML = "2006-01-02T15:04:05-07:00"
)
const (
delimiterLineFrontMatter = "---"
localeDefault = "en"
localeNamespaceDefault = "portal"
)
const (
pkgConfigSchema = "schema"
pkgScriptsGen = "cmd"
)
const (
cmdUseRoot = "authelia-gen"
cmdUseCompletion = "completion"
cmdUseDocs = "docs"
cmdUseDocsDate = "date"
cmdUseDocsCLI = "cli"
cmdUseGitHub = "github"
cmdUseGitHubIssueTemplates = "issue-templates"
cmdUseGitHubIssueTemplatesFR = "feature-request"
cmdUseGitHubIssueTemplatesBR = "bug-report"
cmdUseLocales = "locales"
cmdUseCommitLint = "commit-lint"
cmdUseCode = "code"
cmdUseCodeScripts = "scripts"
cmdUseKeys = "keys"
)
const (
cmdFlagRoot = "dir.root"
cmdFlagExclude = "exclude"
cmdFlagVersions = "versions"
cmdFlagDirLocales = "dir.locales"
cmdFlagDocsCLIReference = "dir.docs.cli-reference"
cmdFlagDocsContent = "dir.docs.content"
cmdFlagDocsDataLanguages = "file.docs.data.languages"
cmdFlagCwd = "cwd"
cmdFlagFileConfigKeys = "file.configuration-keys"
cmdFlagFileDocsKeys = "file.docs-keys"
cmdFlagFileScriptsGen = "file.scripts.gen"
cmdFlagFileConfigCommitLint = "file.commit-lint-config"
cmdFlagFileDocsCommitMsgGuidelines = "file.docs-commit-msg-guidelines"
cmdFlagFileWebI18N = "file.web-i18n"
cmdFlagFeatureRequest = "file.feature-request"
cmdFlagBugReport = "file.bug-report"
cmdFlagPackageConfigKeys = "package.configuration.keys"
cmdFlagPackageScriptsGen = "package.scripts.gen"
)

View File

@ -1,29 +1,7 @@
package main
import (
"embed"
"github.com/spf13/cobra"
)
//go:embed templates/*
var templatesFS embed.FS
func main() {
if err := newRootCmd().Execute(); err != nil {
if err := rootCmd.Execute(); err != nil {
panic(err)
}
}
func newRootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "authelia-gen",
Short: "Authelia's generator tooling",
DisableAutoGenTag: true,
}
cmd.AddCommand(newAllCmd(), newCodeCmd(), newDocsCmd())
return cmd
}

View File

@ -0,0 +1,69 @@
package main
import (
"embed"
"fmt"
"strings"
"text/template"
)
//go:embed templates/*
var templatesFS embed.FS
var (
funcMap = template.FuncMap{
"stringsContains": strings.Contains,
"join": strings.Join,
"joinX": fmJoinX,
}
tmplCodeConfigurationSchemaKeys = template.Must(newTMPL("internal_configuration_schema_keys.go"))
tmplGitHubIssueTemplateBug = template.Must(newTMPL("github_issue_template_bug_report.yml"))
tmplIssueTemplateFeature = template.Must(newTMPL("github_issue_template_feature.yml"))
tmplWebI18NIndex = template.Must(newTMPL("web_i18n_index.ts"))
tmplDotCommitLintRC = template.Must(newTMPL("dot_commitlintrc.js"))
tmplDocsCommitMessageGuidelines = template.Must(newTMPL("docs-contributing-development-commitmsg.md"))
tmplScriptsGen = template.Must(newTMPL("cmd-authelia-scripts-gen.go"))
)
func fmJoinX(elems []string, sep string, n int, p string) string {
buf := strings.Builder{}
c := 0
e := len(elems) - 1
for i := 0; i <= e; i++ {
if c+len(elems[i])+1 > n {
c = 0
buf.WriteString(p)
}
c += len(elems[i]) + 1
buf.WriteString(elems[i])
if i < e {
buf.WriteString(sep)
}
}
return buf.String()
}
func newTMPL(name string) (tmpl *template.Template, err error) {
return template.New(name).Funcs(funcMap).Parse(mustLoadTmplFS(name))
}
func mustLoadTmplFS(tmpl string) string {
var (
content []byte
err error
)
if content, err = templatesFS.ReadFile(fmt.Sprintf("templates/%s.tmpl", tmpl)); err != nil {
panic(err)
}
return string(content)
}

View File

@ -0,0 +1,11 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen code scripts
//
package {{ .Package }}
const (
versionSwaggerUI = "{{ .VersionSwaggerUI }}"
)

View File

@ -0,0 +1,138 @@
---
title: "Commit Message Guidelines"
description: "Authelia Development Commit Message Guidelines"
lead: "This section covers the git commit message guidelines we use for development."
date: 2021-01-30T19:29:07+11:00
draft: false
images: []
menu:
contributing:
parent: "development"
weight: 231
toc: true
aliases:
- /docs/contributing/commitmsg-guidelines.html
---
The reasons for these conventions are as follows:
* simple navigation though git history
* easier to read git history
## Commit Message Format
Each commit message consists of a __header__, a __body__, and a __footer__.
```bash
<header>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
The `header` is mandatory and must conform to the [Commit Message Header](#commit-message-header) format. The header
cannot be longer than 72 characters.
The `body` is mandatory for all commits except for those of type "docs". When the body is present it must be at least 20
characters long and must conform to the [Commit Message Body](#commit-message-body) format.
The `footer` is optional. The [Commit Message Footer](#commit-message-footer) format describes what the footer is used
for, and the structure it must have.
### Commit Message Header
```text
<type>(<scope>): <summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: {{ joinX .Scopes.All "|" 70 "\n │ " }}
└─⫸ Commit Type: {{ join .Types.List "|" }}
```
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
#### Allowed type values:
{{ range .Types.Details }}
* __{{ .Name }}__ {{ .Description }}
{{- if .Scopes }}
(example scopes: {{ join .Scopes ", " }})
{{- end }}
{{- end }}
#### Allowed scope values:
The scope should be the name of the package affected (as perceived by the person reading the changelog generated from
commit messages).
{{ range .Scopes.Packages }}
* {{ . }}
{{- end }}
There are currently a few exceptions to the "use package name" rule:
{{ range .Scopes.Extra }}
* `{{ .Name }}`: {{ .Description }}
{{- end }}
* none/empty string: useful for `test`, `refactor` and changes that are done across multiple packages
(e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package
(e.g. `docs: fix typo in tutorial`).
#### Summary
Use the summary field to provide a succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end
### Commit Message Body
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
Explain the motivation for the change in the commit message body. This commit message should explain *why* you are
making the change. You can include a comparison of the previous behavior with the new behavior in order to illustrate
the impact of the change.
### Commit Message Footer
The footer can contain information about breaking changes and is also the place to reference GitHub issues and other PRs
that this commit closes or is related to.
```text
BREAKING CHANGE: <breaking change summary>
<BLANK LINE>
<breaking change description + migration instructions>
<BLANK LINE>
<BLANK LINE>
Fixes #<issue number>
```
Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a
blank line, and a detailed description of the breaking change that also includes migration instructions.
### Revert Commits
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit.
The content of the commit message body should contain:
* information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`,
* a clear description of the reason for reverting the commit message.
## Commit Message Examples
```bash
fix(logging): disabled colored logging outputs when file is specified
In some scenarios if a user has a log_file_path specified and a TTY seems to be detected this causes terminal coloring outputs to be written to the file.
This in turn will cause issues when attempting to utilise the log with the provided fail2ban regexes.
We now override any TTY detection/logging treatments and disable coloring/removal of the timestamp when a user is utilising the text based logger to a file.
Fixes #1480.
```
This document is based on [AngularJS Git Commit Message Format].
[AngularJS Git Commit Message Format]: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit

View File

@ -0,0 +1,25 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"body-max-line-length": [2, "always", "Infinity"],
"body-min-length": [2, "always", 20],
"header-case": [2, "always", "lower-case"],
"header-max-length": [2, "always", 72],
"type-enum": [
2,
"always",
["{{ join .Types.List "\", \"" }}"],
],
"scope-enum": [
2,
"always",
[
{{- range .Scopes.All }}
"{{ . }}",
{{- end }}
],
],
},
defaultIgnores: true,
helpUrl: "https://www.authelia.com/contributing/development/guidelines-commit-message/",
};

View File

@ -0,0 +1,108 @@
---
name: Bug Report
description: Report a bug
labels:
{{- range .Labels }}
- {{ . }}
{{- end }}
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report. If you are unsure if this is actually a bug we generally recommend creating a [Question and Answer Discussion](https://github.com/authelia/authelia/discussions/new?category=q-a) first.
Please review the following requirements before submitting this issue type:
1. Please ensure you do not report security vulnerabilities via this method. See our [Security Policy](https://www.authelia.com/security-policy).
2. Please try to give as much information as possible for us to be able to reproduce the issue and provide a quick fix.
3. Please ensure an issue does not already exist for this potential bug.
4. Please only provide specific versions. Latest is not a version.
5. Please read the [Troubleshooting Sanitization](https://www.authelia.com/r/sanitize) reference guide if you plan on removing or adjusting any values for the logs or configuration files
- type: dropdown
id: version
attributes:
label: Version
description: What version(s) of Authelia can you reproduce this bug on?
multiple: true
options:
{{- range .Versions }}
- {{ . }}
{{- end }}
validations:
required: true
- type: dropdown
id: deployment
attributes:
label: Deployment Method
description: How are you deploying Authelia?
options:
- Docker
- Kubernetes
- Bare-metal
- Other
validations:
required: true
- type: dropdown
id: proxy
attributes:
label: Reverse Proxy
description: What reverse proxy are you using?
options:
{{- range .Proxies }}
- {{ . }}
{{- end }}
validations:
required: true
- type: input
id: proxy-version
attributes:
label: Reverse Proxy Version
description: What is the version of your reverse proxy?
placeholder: x.x.x
validations:
required: false
- type: textarea
id: description
attributes:
label: Description
description: Describe the bug
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Describe how we can reproduce this issue
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: Provide the logs (the template will automatically put this content in a code block)
render: shell
validations:
required: false
- type: textarea
id: configuration
attributes:
label: Configuration
description: Provide the Authelia configuration file (the template will automatically put this content in a code block)
render: yaml
validations:
required: false
- type: textarea
id: expectations
attributes:
label: Expectations
description: Describe the desired or expected results
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Provide any relevant specification or other documentation if applicable
validations:
required: false
...

View File

@ -0,0 +1,47 @@
---
name: Feature Request
description: Submit a Feature for Design which Has Been Submitted as an Idea and has been voted on
labels:
{{- range .Labels }}
- {{ . }}
{{- end }}
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request. A feature request is created as issue for the purpose of tracking the design and implementation of a feature.
Please review the following requirements before submitting this issue type:
1. Ensure there are no other similar feature requests.
2. Make sure you've checked the [Documentation](https://www.authelia.com) doesn't clearly document the features existence already.
3. Consider creating an [Idea Discussion](https://github.com/authelia/authelia/discussions/new?category=ideas) which can be voted on instead if one doesn't exist.
- type: textarea
id: description
attributes:
label: Description
description: Describe the feature
validations:
required: true
- type: textarea
id: use-case
attributes:
label: Use Case
description: Provide a use case
validations:
required: true
- type: textarea
id: details
attributes:
label: Details
description: Describe the feature in detail
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Provide any relevant specification or other documentation if applicable
validations:
required: false
...

View File

@ -0,0 +1,47 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen locales
//
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
import { getBasePath } from "@utils/BasePath";
const basePath = getBasePath();
i18n.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
detection: {
order: ["querystring", "navigator"],
lookupQuerystring: "lng",
},
backend: {
loadPath: basePath + "/locales/{{"{{lng}}"}}/{{"{{ns}}"}}.json",
},
load: "all",
ns: [{{ range $i, $value := .Namespaces }}{{ if eq $i 0 }}"{{ $value }}"{{ else }}, "{{ $value }}"{{ end }}{{ end }}],
defaultNS: "{{ .Defaults.Namespace }}",
fallbackLng: {
default: ["{{ .Defaults.Language.Locale }}"],
{{- range .Languages }}
{{- if and (not (eq .Locale "en")) (not (eq (len .Fallbacks) 0)) }}
{{ if stringsContains .Locale "-" }}"{{ .Locale }}"{{ else }}{{ .Locale }}{{ end }}: [{{ range $i, $value := .Fallbacks }}{{ if eq $i 0 }}"{{ $value }}"{{ else }}, "{{ $value }}"{{ end }}{{ end }}],
{{- end }}
{{- end }}
},
supportedLngs: [{{ range $i, $value := .Languages }}{{ if eq $i 0 }}"{{ $value.Locale }}"{{ else }}, "{{ $value.Locale }}"{{ end }}{{ end }}],
lowerCaseLng: false,
nonExplicitSupportedLngs: true,
interpolation: {
escapeValue: false,
},
debug: false,
});
export default i18n;

View File

@ -0,0 +1,123 @@
package main
import (
"fmt"
"strings"
"time"
"golang.org/x/text/language"
)
type tmplIssueTemplateData struct {
Labels []string
Versions []string
Proxies []string
}
type tmplConfigurationKeysData struct {
Timestamp time.Time
Keys []string
Package string
}
type tmplScriptsGEnData struct {
Package string
VersionSwaggerUI string
}
// ConfigurationKey is the docs json model for the Authelia configuration keys.
type ConfigurationKey struct {
Path string `json:"path"`
Secret bool `json:"secret"`
Env string `json:"env"`
}
// Languages is the docs json model for the Authelia languages configuration.
type Languages struct {
Defaults DefaultsLanguages `json:"defaults"`
Namespaces []string `json:"namespaces"`
Languages []Language `json:"languages"`
}
type DefaultsLanguages struct {
Language Language `json:"language"`
Namespace string `json:"namespace"`
}
// Language is the docs json model for a language.
type Language struct {
Display string `json:"display"`
Locale string `json:"locale"`
Namespaces []string `json:"namespaces,omitempty"`
Fallbacks []string `json:"fallbacks,omitempty"`
Tag language.Tag `json:"-"`
}
const (
labelAreaPrefixPriority = "priority"
labelAreaPrefixType = "type"
labelAreaPrefixStatus = "status"
)
type labelPriority int
//nolint:deadcode // Kept for future use.
const (
labelPriorityCritical labelPriority = iota
labelPriorityHigh
labelPriorityMedium
labelPriorityNormal
labelPriorityLow
)
var labelPriorityDescriptions = [...]string{
"Critical",
"High",
"Medium",
"Normal",
"Low",
}
func (p labelPriority) String() string {
return fmt.Sprintf("%s/%d-%s", labelAreaPrefixPriority, p+1, strings.ToLower(labelPriorityDescriptions[p]))
}
func (p labelPriority) Description() string {
return labelPriorityDescriptions[p]
}
type labelStatus int
const (
labelStatusNeedsDesign labelStatus = iota
labelStatusNeedsTriage
)
var labelStatusDescriptions = [...]string{
"needs-design",
"needs-triage",
}
func (s labelStatus) String() string {
return fmt.Sprintf("%s/%s", labelAreaPrefixStatus, labelStatusDescriptions[s])
}
type labelType int
//nolint:deadcode // Kept for future use.
const (
labelTypeFeature labelType = iota
labelTypeBugUnconfirmed
labelTypeBug
)
var labelTypeDescriptions = [...]string{
"feature",
"bug/unconfirmed",
"bug",
}
func (t labelType) String() string {
return fmt.Sprintf("%s/%s", labelAreaPrefixType, labelTypeDescriptions[t])
}

View File

@ -146,8 +146,7 @@ func buildFrontend(branch string) {
}
func buildSwagger() {
swaggerVer := "4.13.0"
cmd := utils.CommandWithStdout("bash", "-c", "wget -q https://github.com/swagger-api/swagger-ui/archive/v"+swaggerVer+".tar.gz -O ./v"+swaggerVer+".tar.gz")
cmd := utils.CommandWithStdout("bash", "-c", "wget -q https://github.com/swagger-api/swagger-ui/archive/v"+versionSwaggerUI+".tar.gz -O ./v"+versionSwaggerUI+".tar.gz")
err := cmd.Run()
if err != nil {
@ -161,14 +160,14 @@ func buildSwagger() {
log.Fatal(err)
}
cmd = utils.CommandWithStdout("tar", "-C", "internal/server/public_html/api", "--exclude=index.html", "--strip-components=2", "-xf", "v"+swaggerVer+".tar.gz", "swagger-ui-"+swaggerVer+"/dist")
cmd = utils.CommandWithStdout("tar", "-C", "internal/server/public_html/api", "--exclude=index.html", "--strip-components=2", "-xf", "v"+versionSwaggerUI+".tar.gz", "swagger-ui-"+versionSwaggerUI+"/dist")
err = cmd.Run()
if err != nil {
log.Fatal(err)
}
cmd = utils.CommandWithStdout("rm", "./v"+swaggerVer+".tar.gz")
cmd = utils.CommandWithStdout("rm", "./v"+versionSwaggerUI+".tar.gz")
err = cmd.Run()
if err != nil {

View File

@ -0,0 +1,11 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen code scripts
//
package cmd
const (
versionSwaggerUI = "4.14.0"
)

View File

@ -48,18 +48,18 @@
weight = 10
[[footer]]
name = "Privacy"
url = "/information/privacy-policy"
name = "Privacy Policy"
url = "/policies/privacy"
weight = 10
[[footer]]
name = "Code of Conduct"
url = "/information/code-of-conduct"
name = "Security Policy"
url = "/policies/security"
weight = 20
[[footer]]
name = "Security"
url = "/information/security"
name = "Code of Conduct"
url = "/code-of-conduct"
weight = 30
[[footer]]

View File

@ -50,3 +50,7 @@ Can be replaced by this environment variable configuration:
AUTHELIA_LOG_LEVEL=info
AUTHELIA_SERVER_BUFFERS_READ=4096
```
## Environment Variables
{{% table-config-keys secrets="false" %}}

View File

@ -52,24 +52,11 @@ Here is the list of the environment variables which are considered secrets and c
secrets can be loaded into the configuration if they end with one of the suffixes above, you can set the value of any
other configuration using the environment but instead of loading a file the value of the environment variable is used.
| Configuration Key | Environment Variable |
|:---------------------------------------------------:|:--------------------------------------------------------:|
| [server.tls.key] | AUTHELIA_SERVER_TLS_KEY_FILE |
| [jwt_secret] | AUTHELIA_JWT_SECRET_FILE |
| [duo_api.secret_key] | AUTHELIA_DUO_API_SECRET_KEY_FILE |
| [session.secret] | AUTHELIA_SESSION_SECRET_FILE |
| [session.redis.password] | AUTHELIA_SESSION_REDIS_PASSWORD_FILE |
| [session.redis.high_availability.sentinel_password] | AUTHELIA_REDIS_HIGH_AVAILABILITY_SENTINEL_PASSWORD_FILE |
| [storage.encryption_key] | AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE |
| [storage.mysql.password] | AUTHELIA_STORAGE_MYSQL_PASSWORD_FILE |
| [storage.postgres.password] | AUTHELIA_STORAGE_POSTGRES_PASSWORD_FILE |
| [notifier.smtp.password] | AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE |
| [authentication_backend.ldap.password] | AUTHELIA_AUTHENTICATION_BACKEND_LDAP_PASSWORD_FILE |
| [identity_providers.oidc.issuer_private_key] | AUTHELIA_IDENTITY_PROVIDERS_OIDC_ISSUER_PRIVATE_KEY_FILE |
| [identity_providers.oidc.hmac_secret] | AUTHELIA_IDENTITY_PROVIDERS_OIDC_HMAC_SECRET_FILE |
{{% table-config-keys secrets="true" %}}
[server.tls.key]: ../miscellaneous/server.md#key
[jwt_secret]: ../miscellaneous/introduction.md#jwt_secret
[duo_api.integration_key]: ../second-factor/duo.md#integration_key
[duo_api.secret_key]: ../second-factor/duo.md#secret_key
[session.secret]: ../session/introduction.md#secret
[session.redis.password]: ../session/redis.md#password
@ -77,6 +64,7 @@ other configuration using the environment but instead of loading a file the valu
[storage.encryption_key]: ../storage/introduction.md#encryption_key
[storage.mysql.password]: ../storage/mysql.md#password
[storage.postgres.password]: ../storage/postgres.md#password
[storage.postgres.ssl.key]: ../storage/postgres.md#key
[notifier.smtp.password]: ../notifications/smtp.md#password
[authentication_backend.ldap.password]: ../first-factor/ldap.md#password
[identity_providers.oidc.issuer_private_key]: ../identity-providers/open-id-connect.md#issuer_private_key

View File

@ -47,11 +47,13 @@ for, and the structure it must have.
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: api|authentication|authorization|cmd|commands|configuration|duo|
│ handlers|logging|middlewares|mocks|model|notification|ntp|oidc|
│ regulation|server|session|storage|suites|templates|utils|web
│ └─⫸ Commit Scope: api|autheliabot|authentication|authorization|buildkite|bundler|cmd|
│ codecov|commands|configuration|deps|docker|duo|go|golangci-lint|
│ handlers|logging|metrics|middlewares|mocks|model|notification|npm|ntp|
│ oidc|regulation|renovate|reviewdog|server|session|storage|suites|
│ templates|totp|utils|web
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|release|test
└─⫸ Commit Type: build|ci|docs|feat|fix|i18n|perf|refactor|release|revert|test
```
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
@ -65,6 +67,7 @@ The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is opti
* __docs__ Documentation only changes
* __feat__ A new feature
* __fix__ A bug fix
* __i18n__ Updating translations or internationalization settings
* __perf__ A code change that improves performance
* __refactor__ A code change that neither fixes a bug nor adds a feature
* __release__ Releasing a new version of Authelia
@ -101,7 +104,7 @@ commit messages).
There are currently a few exceptions to the "use package name" rule:
* `api`: used for changes that change the openapi specification
* `cmd`: used for changes to the `authelia|authelia-scripts|authelia-suites` top level binaries
* `cmd`: used for changes to the `authelia|authelia-gen|authelia-scripts|authelia-suites` top level binaries
* `web`: used for changes to the React based frontend
* none/empty string: useful for `test`, `refactor` and changes that are done across multiple packages
(e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package

View File

@ -29,6 +29,6 @@ __TLDR__: We do not use cookies and we do not collect any personal data.
## Contact us
[Contact us](contact.md) if you have any questions.
[Contact us](../information/contact.md) if you have any questions.
__Effective Date:__ *16th May 2022*

View File

@ -1,10 +1,11 @@
---
title: "Security"
description: "Report security issues."
title: "Security Policy"
description: "The Authelia Security Policy which is essential reading for reporting security issues"
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
aliases:
- /security-policy
- /security
- /security.html
---
@ -36,7 +37,7 @@ This is the preferred method of reporting.
### Chat
If you wish to chat directly instead of sending an email please use one of the [chat options](contact.md#chat) but it
If you wish to chat directly instead of sending an email please use one of the [chat options](../information/contact.md#chat) but it
is vital that when you do that you only do so privately with one of the maintainers. In order to start a private
discussion you should ask to have a private discussion with a team member without mentioning the reason why you wish to
have a private discussion so that provided the bug is confirmed we can coordinate the release of fixes and information

View File

@ -16,15 +16,39 @@ toc: true
Authelia's generator tooling
```
authelia-gen [flags]
```
### Options
```
-h, --help help for authelia-gen
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
-h, --help help for authelia-gen
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen all](authelia-gen_all.md) - Run all generators with default options
* [authelia-gen code](authelia-gen_code.md) - Generate code
* [authelia-gen commit-lint](authelia-gen_commit-lint.md) - Generate commit lint files
* [authelia-gen docs](authelia-gen_docs.md) - Generate docs
* [authelia-gen github](authelia-gen_github.md) - Generate GitHub files
* [authelia-gen locales](authelia-gen_locales.md) - Generate locales files

View File

@ -1,32 +0,0 @@
---
title: "authelia-gen all"
description: "Reference for the authelia-gen all command."
lead: ""
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen all
Run all generators with default options
```
authelia-gen all [flags]
```
### Options
```
-h, --help help for all
```
### SEE ALSO
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling

View File

@ -26,8 +26,32 @@ authelia-gen code [flags]
-h, --help help for code
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling
* [authelia-gen code keys](authelia-gen_code_keys.md) - Generate the list of valid configuration keys
* [authelia-gen code scripts](authelia-gen_code_scripts.md) - Generate the generated portion of the authelia-scripts command

View File

@ -23,9 +23,30 @@ authelia-gen code keys [flags]
### Options
```
-f, --file string Sets the path of the keys file (default "./internal/configuration/schema/keys.go")
-h, --help help for keys
--package string Sets the package name of the keys file (default "schema")
-h, --help help for keys
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen code scripts"
description: "Reference for the authelia-gen code scripts command."
lead: ""
date: 2022-08-01T10:11:13+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen code scripts
Generate the generated portion of the authelia-scripts command
```
authelia-gen code scripts [flags]
```
### Options
```
-h, --help help for scripts
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen code](authelia-gen_code.md) - Generate code

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen commit-lint"
description: "Reference for the authelia-gen commit-lint command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen commit-lint
Generate commit lint files
```
authelia-gen commit-lint [flags]
```
### Options
```
-h, --help help for commit-lint
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling

View File

@ -23,8 +23,30 @@ authelia-gen docs [flags]
### Options
```
-C, --cwd string Sets the CWD for git commands
-h, --help help for docs
-h, --help help for docs
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
@ -32,4 +54,5 @@ authelia-gen docs [flags]
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling
* [authelia-gen docs cli](authelia-gen_docs_cli.md) - Generate CLI docs
* [authelia-gen docs date](authelia-gen_docs_date.md) - Generate doc dates
* [authelia-gen docs keys](authelia-gen_docs_keys.md) - Generate the docs data file for configuration keys

View File

@ -23,14 +23,30 @@ authelia-gen docs cli [flags]
### Options
```
-d, --directory string The directory to store the markdown in (default "./docs/content/en/reference/cli")
-h, --help help for cli
-h, --help help for cli
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO

View File

@ -2,7 +2,7 @@
title: "authelia-gen docs date"
description: "Reference for the authelia-gen docs date command."
lead: ""
date: 2022-09-01T12:28:38+10:00
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
menu:
@ -25,14 +25,30 @@ authelia-gen docs date [flags]
```
--commit-since string The commit to check the logs since
--commit-until string The commit to check the logs until (default "HEAD")
-d, --directory string The directory to modify (default "./docs/content")
-h, --help help for date
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen docs keys"
description: "Reference for the authelia-gen docs keys command."
lead: ""
date: 2022-09-16T13:42:10+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen docs keys
Generate the docs data file for configuration keys
```
authelia-gen docs keys [flags]
```
### Options
```
-h, --help help for keys
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen docs](authelia-gen_docs.md) - Generate docs

View File

@ -1,42 +0,0 @@
---
title: "authelia-gen docs time"
description: "Reference for the authelia-gen docs time command."
lead: ""
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen docs time
Generate doc timestamps
```
authelia-gen docs time [flags]
```
### Options
```
--commit-since string The commit to check the logs since
--commit-until string The commit to check the logs until (default "HEAD")
-d, --directory string The directory to modify (default "./docs/content")
-h, --help help for time
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
```
### SEE ALSO
* [authelia-gen docs](authelia-gen_docs.md) - Generate docs
###### Auto generated by spf13/cobra on 12-Jun-2022

View File

@ -0,0 +1,56 @@
---
title: "authelia-gen github"
description: "Reference for the authelia-gen github command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen github
Generate GitHub files
```
authelia-gen github [flags]
```
### Options
```
-h, --help help for github
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling
* [authelia-gen github issue-templates](authelia-gen_github_issue-templates.md) - Generate GitHub issue templates

View File

@ -0,0 +1,57 @@
---
title: "authelia-gen github issue-templates"
description: "Reference for the authelia-gen github issue-templates command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen github issue-templates
Generate GitHub issue templates
```
authelia-gen github issue-templates [flags]
```
### Options
```
-h, --help help for issue-templates
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen github](authelia-gen_github.md) - Generate GitHub files
* [authelia-gen github issue-templates bug-report](authelia-gen_github_issue-templates_bug-report.md) - Generate GitHub bug report issue template
* [authelia-gen github issue-templates feature-request](authelia-gen_github_issue-templates_feature-request.md) - Generate GitHub feature request issue template

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen github issue-templates bug-report"
description: "Reference for the authelia-gen github issue-templates bug-report command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen github issue-templates bug-report
Generate GitHub bug report issue template
```
authelia-gen github issue-templates bug-report [flags]
```
### Options
```
-h, --help help for bug-report
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen github issue-templates](authelia-gen_github_issue-templates.md) - Generate GitHub issue templates

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen github issue-templates feature-request"
description: "Reference for the authelia-gen github issue-templates feature-request command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen github issue-templates feature-request
Generate GitHub feature request issue template
```
authelia-gen github issue-templates feature-request [flags]
```
### Options
```
-h, --help help for feature-request
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen github issue-templates](authelia-gen_github_issue-templates.md) - Generate GitHub issue templates

View File

@ -0,0 +1,55 @@
---
title: "authelia-gen locales"
description: "Reference for the authelia-gen locales command."
lead: ""
date: 2022-07-31T12:57:53+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen locales
Generate locales files
```
authelia-gen locales [flags]
```
### Options
```
-h, --help help for locales
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/development/guidelines-commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling

View File

@ -1,39 +0,0 @@
---
title: "authelia-scripts certificates"
description: "Reference for the authelia-scripts certificates command."
lead: ""
date: 2022-06-15T17:51:47+10:00
lastmod: 2022-06-03T11:17:29+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-scripts"
weight: 330
toc: true
---
## authelia-scripts certificates
Commands related to certificate generation
### Options
```
-h, --help help for certificates
--host strings Comma-separated hostnames and IPs to generate a certificate for
```
### Options inherited from parent commands
```
--buildkite Set CI flag for Buildkite
--log-level string Set the log level for the command (default "info")
```
### SEE ALSO
* [authelia-scripts](authelia-scripts.md) -
* [authelia-scripts certificates generate](authelia-scripts_certificates_generate.md) - Generate a self-signed certificate
###### Auto generated by spf13/cobra on 3-Jun-2022

View File

@ -1,49 +0,0 @@
---
title: "authelia-scripts certificates generate"
description: "Reference for the authelia-scripts certificates generate command."
lead: ""
date: 2022-06-15T17:51:47+10:00
lastmod: 2022-06-03T11:17:29+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-scripts"
weight: 330
toc: true
---
## authelia-scripts certificates generate
Generate a self-signed certificate
```
authelia-scripts certificates generate [flags]
```
### Options
```
--ca Whether this cert should be its own Certificate Authority
--dir string Target directory where the certificate and keys will be stored
--duration duration Duration that certificate is valid for (default 8760h0m0s)
--ecdsa-curve string ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521
--ed25519 Generate an Ed25519 key
-h, --help help for generate
--rsa-bits int Size of RSA key to generate. Ignored if --ecdsa-curve is set (default 2048)
--start-date string Creation date formatted as Jan 1 15:04:05 2011
```
### Options inherited from parent commands
```
--buildkite Set CI flag for Buildkite
--host strings Comma-separated hostnames and IPs to generate a certificate for
--log-level string Set the log level for the command (default "info")
```
### SEE ALSO
* [authelia-scripts certificates](authelia-scripts_certificates.md) - Commands related to certificate generation
###### Auto generated by spf13/cobra on 3-Jun-2022

View File

@ -1,49 +0,0 @@
---
title: "authelia-scripts hash-password"
description: "Reference for the authelia-scripts hash-password command."
lead: ""
date: 2022-06-15T17:51:47+10:00
lastmod: 2022-06-03T11:17:29+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-scripts"
weight: 330
toc: true
---
## authelia-scripts hash-password
Hash a password to be used in file-based users database. Default algorithm is argon2id.
```
authelia-scripts hash-password [flags] -- <password>
```
### Options
```
-c, --config strings Configuration files
-h, --help help for hash-password
-i, --iterations int set the number of hashing iterations (default 3)
-k, --key-length int [argon2id] set the key length param (default 32)
-m, --memory int [argon2id] set the amount of memory param (in MB) (default 64)
-p, --parallelism int [argon2id] set the parallelism param (default 4)
-s, --salt string set the salt string
-l, --salt-length int set the auto-generated salt length (default 16)
-z, --sha512 use sha512 as the algorithm (changes iterations to 50000, change with -i)
```
### Options inherited from parent commands
```
--buildkite Set CI flag for Buildkite
--log-level string Set the log level for the command (default "info")
```
### SEE ALSO
* [authelia-scripts](authelia-scripts.md) -
###### Auto generated by spf13/cobra on 3-Jun-2022

View File

@ -1,38 +0,0 @@
---
title: "authelia-scripts rsa"
description: "Reference for the authelia-scripts rsa command."
lead: ""
date: 2022-06-15T17:51:47+10:00
lastmod: 2022-06-03T11:17:29+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-scripts"
weight: 330
toc: true
---
## authelia-scripts rsa
Commands related to rsa keypair generation
### Options
```
-h, --help help for rsa
```
### Options inherited from parent commands
```
--buildkite Set CI flag for Buildkite
--log-level string Set the log level for the command (default "info")
```
### SEE ALSO
* [authelia-scripts](authelia-scripts.md) -
* [authelia-scripts rsa generate](authelia-scripts_rsa_generate.md) - Generate a RSA keypair
###### Auto generated by spf13/cobra on 3-Jun-2022

View File

@ -1,43 +0,0 @@
---
title: "authelia-scripts rsa generate"
description: "Reference for the authelia-scripts rsa generate command."
lead: ""
date: 2022-06-15T17:51:47+10:00
lastmod: 2022-06-03T11:17:29+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-scripts"
weight: 330
toc: true
---
## authelia-scripts rsa generate
Generate a RSA keypair
```
authelia-scripts rsa generate [flags]
```
### Options
```
-d, --dir string Target directory where the keypair will be stored
-h, --help help for generate
-b, --key-size int Sets the key size in bits (default 2048)
```
### Options inherited from parent commands
```
--buildkite Set CI flag for Buildkite
--log-level string Set the log level for the command (default "info")
```
### SEE ALSO
* [authelia-scripts rsa](authelia-scripts_rsa.md) - Commands related to rsa keypair generation
###### Auto generated by spf13/cobra on 3-Jun-2022

View File

@ -1,30 +0,0 @@
---
title: "Domain Sanitization"
description: "This guide describes and helps users sanitize provided files to hide their domain"
lead: "This guide describes and helps users sanitize provided files to hide their domain."
date: 2022-08-26T13:50:51+10:00
draft: false
images: []
menu:
reference:
parent: "guides"
weight: 220
toc: true
---
Some users may wish to hide their domain in files provided during troubleshooting. While this is discouraged, if a user
decides to perform this action it's critical for these purposes that you hide your domain in a very specific
way. Most editors allow replacing all instances of a value, utilizing this is essential to making troubleshooting
possible.
## General Rule
Only replace the purchased portion of domains. For example if you have `auth.abc123.com` and `app.abc123.com` they
should become `auth.example.com` and `app.example.com`, i.e. replace all instances of `abc123.com` with `example.com`.
## Multiple Domains
*__Replacement Value:__* `example#.com` (where `#` is a unique number per domain)
In instances where there are multiple domains it's recommended these domains are replaced with `example1.com`,
`example2.com`, etc.

View File

@ -0,0 +1,17 @@
---
title: "Internationalization"
description: "A collection of internationalization reference information"
lead: "This section contains internationalization references for Authelia."
date: 2022-08-01T10:44:40+10:00
draft: false
images: []
menu:
reference:
parent: "guides"
weight: 220
toc: true
---
## Web Portal Internationalization
{{% table-i18n-locales %}}

View File

@ -0,0 +1,43 @@
---
title: "Troubleshooting Sanitization"
description: "This guide describes and helps users sanitize provided files to hide privacy related values for troubleshooting"
lead: "This guide describes and helps users sanitize provided files to hide information for privacy."
date: 2022-09-16T12:50:04+10:00
draft: false
images: []
menu:
reference:
parent: "guides"
weight: 220
toc: true
aliases:
- /r/sanitize
- /reference/guides/domain-sanitizaiton
---
Some users may wish to hide their domain in files provided during troubleshooting. While this is discouraged, if a user
decides to perform this action it's critical for these purposes that you hide your domain in a very specific
way. Most editors allow replacing all instances of a value, utilizing this is essential to making troubleshooting
possible.
## General Rules
1. Only replace the purchased portion of domains:
- For example if you have `auth.abc123.com` and `app.abc123.com` they
should become `auth.example.com` and `app.example.com`, i.e. replace all instances of `abc123.com` with `example.com`.
2. Make sure value replaced is replaced with a unique value:
- For example if you replace `abc123.com` with `example.com` DO NOT replace any other value other than `abc123.com` with
`example.com`. The same rule applies to IP addresses, usernames, and groups.
3. Make sure the value replaced is replaced across logs, configuration, and any references:
- For example if you replace `abc123.com` with `example.com` in your configuration, make exactly the same replacement
for the log files.
4. Make sure this consistency is followed for all communication regarding a single issue.
## Multiple Domains
*__Replacement Value:__* `example#.com` (where `#` is a unique number per domain)
In instances where there are multiple domains it's recommended these domains are replaced with `example1.com`,
`example2.com`, etc.
## Specific Values

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"defaultLocale":"en","defaultNamespace":"portal","namespaces":["portal"],"languages":[{"display":"German","locale":"de","namespaces":["portal"],"fallbacks":["en"]},{"display":"English","locale":"en","namespaces":["portal"],"fallbacks":["en"]},{"display":"Spanish","locale":"es","namespaces":["portal"],"fallbacks":["en"]},{"display":"French","locale":"fr","namespaces":["portal"],"fallbacks":["en"]},{"display":"Russian","locale":"ru","namespaces":["portal"],"fallbacks":["en"]},{"display":"Swedish","locale":"sv","namespaces":["portal"],"fallbacks":["en"]},{"display":"Swedish (Sweden)","locale":"sv-SE","namespaces":["portal"],"fallbacks":["sv","en"]},{"display":"Chinese (Taiwan)","locale":"zh-TW","namespaces":["portal"],"fallbacks":["en"]}]}
{"defaults":{"language":{"display":"English","locale":"en"},"namespace":"portal"},"namespaces":["portal"],"languages":[{"display":"English","locale":"en","namespaces":["portal"],"fallbacks":["en"]},{"display":"German","locale":"de","namespaces":["portal"],"fallbacks":["en"]},{"display":"Spanish","locale":"es","namespaces":["portal"],"fallbacks":["en"]},{"display":"French","locale":"fr","namespaces":["portal"],"fallbacks":["en"]},{"display":"Dutch","locale":"nl","namespaces":["portal"],"fallbacks":["en"]},{"display":"Portuguese","locale":"pt","namespaces":["portal"],"fallbacks":["en"]},{"display":"Russian","locale":"ru","namespaces":["portal"],"fallbacks":["en"]},{"display":"Swedish","locale":"sv","namespaces":["portal"],"fallbacks":["en"]},{"display":"Swedish (Sweden)","locale":"sv-SE","namespaces":["portal"],"fallbacks":["sv","en"]},{"display":"Chinese","locale":"zh","namespaces":["portal"],"fallbacks":["en"]},{"display":"Chinese (China)","locale":"zh-CN","namespaces":["portal"],"fallbacks":["zh","en"]},{"display":"Chinese (Taiwan)","locale":"zh-TW","namespaces":["portal"],"fallbacks":["en"]}]}

View File

@ -0,0 +1,22 @@
{{ define "main" }}
<div class="row justify-content-center">
<div class="col-md-12 col-lg-10 col-xl-8">
<article>
<h1 class="text-center">{{ if eq .CurrentSection .FirstSection }}{{ .Section | humanize }}{{ else }}{{ .Title }}{{ end }}</h1>
<div class="text-center">{{ .Content }}</div>
<div class="card-list">
{{ $currentSection := .CurrentSection }}
{{ range where .Site.RegularPages.ByWeight "Section" .Section }}
{{ if in (.RelPermalink | string) $currentSection.RelPermalink }}
<div class="card my-3">
<div class="card-body">
<a class="stretched-link" href="{{ .RelPermalink }}">{{ if (eq $currentSection.Title .Title) }}Introduction{{ else }}{{ .Params.title | title }}{{ end }} &rarr;</a>
</div>
</div>
{{ end }}
{{ end }}
</div>
</article>
</div>
</div>
{{ end }}

View File

@ -0,0 +1,14 @@
{{ $secrets := .Get "secrets" }}
| Configuration Key | Environment Variable |
|:-----------------:|:--------------------:|
{{- range $.Site.Data.configkeys }}
{{- if eq "true" $secrets }}
{{- if .secret }}
| [{{ .path }}] | {{ .env }} |
{{- end }}
{{- else }}
{{- if not .secret }}
| {{ .path }} | {{ .env }} |
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,5 @@
| Language | Locale | Namespaces | Fallbacks |
|:--------:|:------:|:----------:|:---------:|
{{- range $.Site.Data.languages.languages }}
|{{ .display }}|{{ .locale }}|{{ range $i, $v := .namespaces }}{{ if eq $i 0 }}{{ $v }}{{ else }}, {{ $v }}{{ end }}{{ end }}|{{ range $i, $v := .fallbacks }}{{ if eq $i 0 }}{{ $v }}{{ else }}, {{ $v }}{{ end }}{{ end }}|
{{- end }}

View File

@ -68,6 +68,6 @@
"stylelint-config-standard-scss": "4.0.0"
},
"otherDependencies": {
"hugo": "0.102.2"
"hugo": "0.102.3"
}
}

View File

@ -12,15 +12,12 @@ func getEnvConfigMap(keys []string, prefix, delimiter string) (keyMap map[string
for _, key := range keys {
if strings.Contains(key, delimiter) {
originalKey := prefix + strings.ToUpper(strings.ReplaceAll(key, constDelimiter, delimiter))
keyMap[originalKey] = key
keyMap[ToEnvironmentKey(key, prefix, delimiter)] = key
}
// Secret envs should be ignored by the env parser.
if isSecretKey(key) {
originalKey := strings.ToUpper(strings.ReplaceAll(key, constDelimiter, delimiter)) + constSecretSuffix
ignoredKeys = append(ignoredKeys, prefix+originalKey)
if IsSecretKey(key) {
ignoredKeys = append(ignoredKeys, ToEnvironmentSecretKey(key, prefix, delimiter))
}
}
@ -31,7 +28,7 @@ func getSecretConfigMap(keys []string, prefix, delimiter string) (keyMap map[str
keyMap = make(map[string]string)
for _, key := range keys {
if isSecretKey(key) {
if IsSecretKey(key) {
originalKey := strings.ToUpper(strings.ReplaceAll(key, constDelimiter, delimiter)) + constSecretSuffix
keyMap[prefix+originalKey] = key
@ -41,7 +38,22 @@ func getSecretConfigMap(keys []string, prefix, delimiter string) (keyMap map[str
return keyMap
}
func isSecretKey(key string) (isSecretKey bool) {
// ToEnvironmentKey converts a key into the environment variable name.
func ToEnvironmentKey(key, prefix, delimiter string) string {
return prefix + strings.ToUpper(strings.ReplaceAll(key, constDelimiter, delimiter))
}
// ToEnvironmentSecretKey converts a key into the environment variable name.
func ToEnvironmentSecretKey(key, prefix, delimiter string) string {
return prefix + strings.ToUpper(strings.ReplaceAll(key, constDelimiter, delimiter)) + constSecretSuffix
}
// IsSecretKey returns true if the provided key is a secret enabled key.
func IsSecretKey(key string) (isSecretKey bool) {
if strings.Contains(key, "[]") {
return false
}
return utils.IsStringInSliceSuffix(key, secretSuffixes)
}

View File

@ -7,12 +7,12 @@ import (
)
func TestIsSecretKey(t *testing.T) {
assert.True(t, isSecretKey("my_fake_token"))
assert.False(t, isSecretKey("my_fake_tokenz"))
assert.True(t, isSecretKey("my_.fake.secret"))
assert.True(t, isSecretKey("my.password"))
assert.False(t, isSecretKey("my.passwords"))
assert.False(t, isSecretKey("my.passwords"))
assert.True(t, IsSecretKey("my_fake_token"))
assert.False(t, IsSecretKey("my_fake_tokenz"))
assert.True(t, IsSecretKey("my_.fake.secret"))
assert.True(t, IsSecretKey("my.password"))
assert.False(t, IsSecretKey("my.passwords"))
assert.False(t, IsSecretKey("my.passwords"))
}
func TestGetEnvConfigMaps(t *testing.T) {

View File

@ -36,7 +36,7 @@ func NewYAMLFileSources(paths []string) (sources []*YAMLFileSource) {
}
// Name of the Source.
func (s YAMLFileSource) Name() (name string) {
func (s *YAMLFileSource) Name() (name string) {
return fmt.Sprintf("yaml file(%s)", s.path)
}
@ -64,7 +64,7 @@ func NewEnvironmentSource(prefix, delimiter string) (source *EnvironmentSource)
}
// Name of the Source.
func (s EnvironmentSource) Name() (name string) {
func (s *EnvironmentSource) Name() (name string) {
return "environment"
}
@ -90,7 +90,7 @@ func NewSecretsSource(prefix, delimiter string) (source *SecretsSource) {
}
// Name of the Source.
func (s SecretsSource) Name() (name string) {
func (s *SecretsSource) Name() (name string) {
return "secrets"
}
@ -127,7 +127,7 @@ func NewCommandLineSourceWithMapping(flags *pflag.FlagSet, mapping map[string]st
}
// Name of the Source.
func (s CommandLineSource) Name() (name string) {
func (s *CommandLineSource) Name() (name string) {
return "command-line"
}
@ -154,7 +154,7 @@ func NewMapSource(m map[string]interface{}) (source *MapSource) {
}
// Name of the Source.
func (s MapSource) Name() (name string) {
func (s *MapSource) Name() (name string) {
return "map"
}

View File

@ -1,3 +1,9 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen locales
//
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";