-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide full list of environment overrides (#64)
- Loading branch information
1 parent
11b18d5
commit 73d50a2
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
### Config Environment Overrides | ||
|
||
``` | ||
KEY TYPE | ||
API_HTTP_LISTENADDRESS String | ||
API_HTTP_TLS_ENABLE True or False | ||
API_HTTP_TLS_CERTFILE String | ||
API_HTTP_TLS_CERTKEY String | ||
API_SECURITY_ENABLEADMIN True or False | ||
API_SECURITY_ADMINSECRETKEY String | ||
API_SECURITY_ALLOWSELFREGISTRATION True or False | ||
API_SECURITY_SESSIONCACHE_EXPIRATIONMINUTES Integer | ||
STORE_DATASOURCE String | ||
JOBS_APITYPE JobAPIType | ||
JOBS_MAXCONCURRENTJOBS Integer | ||
JOBS_IMAGEREGISTRY String | ||
JOBS_KUBERNETES_MAXCONCURRENTJOBS Integer | ||
JOBS_KUBERNETES_FAILEDJOBSRETENTIONTIME Duration | ||
JOBS_KUBERNETES_IMAGEREGISTRY String | ||
JOBS_KUBERNETES_JOBSRESOURCEREQUIREMENTS Comma-separated list of Type: pairs | ||
JOBS_KUBERNETES_PERSISTENTVOLUMECLAIMNAME String | ||
JOBS_KUBERNETES_NODESYSCTLS String | ||
JOBS_DOCKER_MAXCONCURRENTJOBS Integer | ||
JOBS_DOCKER_FAILEDJOBSRETENTIONTIME Duration | ||
JOBS_DOCKER_IMAGEREGISTRY String | ||
LOGGER_ENABLECONSOLE True or False | ||
LOGGER_CONSOLEJSON True or False | ||
LOGGER_CONSOLELEVEL String | ||
LOGGER_ENABLEFILE True or False | ||
LOGGER_FILEJSON True or False | ||
LOGGER_FILELEVEL String | ||
LOGGER_FILELOCATION String | ||
LOGGER_ENABLECOLOR True or False | ||
``` | ||
|
||
### Custom Environment Overrides | ||
|
||
``` | ||
KEY TYPE | ||
K8S_NAMESPACE String | ||
The Kubernetes namespace in which jobs will be created. | ||
K8S_JOB_POD_TOLERATIONS String (JSON) | ||
The Kubernetes tolerations to apply to the job pods. | ||
Example: [{"key":"utilities","operator":"Equal","value":"true","effect":"NoSchedule"}] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2025-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"text/tabwriter" | ||
|
||
"github.com/mattermost/calls-offloader/service" | ||
|
||
"github.com/kelseyhightower/envconfig" | ||
) | ||
|
||
const customEnv = ` | ||
KEY TYPE | ||
K8S_NAMESPACE String | ||
The Kubernetes namespace in which jobs will be created. | ||
K8S_JOB_POD_TOLERATIONS String (JSON) | ||
The Kubernetes tolerations to apply to the job pods. | ||
Example: [{"key":"utilities","operator":"Equal","value":"true","effect":"NoSchedule"}] | ||
` | ||
|
||
func main() { | ||
if len(os.Args) < 2 { | ||
log.Fatalf("unexpected number of arguments, need 1") | ||
} | ||
|
||
outFile, err := os.OpenFile(os.Args[1], os.O_RDWR|os.O_CREATE, 0644) | ||
if err != nil { | ||
log.Fatalf("failed to write file: %s", err.Error()) | ||
} | ||
defer outFile.Close() | ||
if err := outFile.Truncate(0); err != nil { | ||
log.Fatalf("failed to truncate file: %s", err.Error()) | ||
} | ||
if _, err := outFile.Seek(0, 0); err != nil { | ||
log.Fatalf("failed to seek file: %s", err.Error()) | ||
} | ||
fmt := "### Config Environment Overrides\n\n```\nKEY TYPE\n{{range .}}{{usage_key .}} {{usage_type .}}\n{{end}}```\n" | ||
tabs := tabwriter.NewWriter(outFile, 1, 0, 4, ' ', 0) | ||
_ = envconfig.Usagef("", &service.Config{}, tabs, fmt) | ||
tabs.Flush() | ||
|
||
// Custom configs | ||
_, err = outFile.WriteString("\n### Custom Environment Overrides\n\n```" + customEnv + "```\n") | ||
if err != nil { | ||
log.Fatalf("failed to write file: %s", err.Error()) | ||
} | ||
} |