Options codegen improvements
- Add extra cli switches to generate docs from options - More automation/fallbacks/default values for options
This commit is contained in:
@@ -4,20 +4,30 @@
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// {{ .Source }}
|
||||
|
||||
= {{ export $.Name }}
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
|
||||
{{- range $prop := $.Properties }}
|
||||
3+| *{{ toUpper $prop.Env }}*
|
||||
|`{{ $prop.Type }}`
|
||||
|{{- if $prop.Default }}
|
||||
{{- $prop.Default -}}
|
||||
{{- end -}}
|
||||
|{{ $prop.Description }}
|
||||
{{- range .Definitions }}
|
||||
// - {{ .Source }}
|
||||
{{- end }}
|
||||
|===
|
||||
|
||||
|
||||
{{ range .Definitions }}
|
||||
|
||||
= {{ .Docs.Title }}
|
||||
|
||||
{{ .Docs.Intro }}
|
||||
|
||||
{{ range .Properties }}
|
||||
|
||||
== *{{ toUpper .Env }}* `{{ .Type }}`
|
||||
|
||||
{{ if .Default }}
|
||||
Default::
|
||||
`{{ .Default }}`
|
||||
{{ end -}}
|
||||
{{ if .Description }}
|
||||
Description::
|
||||
{{ .Description }}
|
||||
{{ end -}}
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -12,11 +12,19 @@ import (
|
||||
)
|
||||
|
||||
func Proc() {
|
||||
const (
|
||||
docPathOptions = "/dev-ops-guide/server-configuration"
|
||||
)
|
||||
|
||||
var (
|
||||
err error
|
||||
|
||||
watchChanges bool
|
||||
beVerbose bool
|
||||
docPath string
|
||||
|
||||
genCode = true
|
||||
genDocs = false
|
||||
|
||||
fileList []string
|
||||
watcher *fsnotify.Watcher
|
||||
@@ -96,8 +104,9 @@ func Proc() {
|
||||
}
|
||||
)
|
||||
|
||||
flag.BoolVar(&watchChanges, "w", false, "regenerate code on template or definition change")
|
||||
flag.BoolVar(&watchChanges, "w", false, "regenerate on change of template or definition files")
|
||||
flag.BoolVar(&beVerbose, "v", false, "output loaded definitions, templates and outputs")
|
||||
flag.StringVar(&docPath, "d", "", "generate docs on template or definition change")
|
||||
flag.Parse()
|
||||
|
||||
defer func() {
|
||||
@@ -106,6 +115,17 @@ func Proc() {
|
||||
}
|
||||
}()
|
||||
|
||||
if len(docPath) > 0 {
|
||||
docPath = strings.TrimRight(docPath, "/") + "/src/modules/ROOT/pages"
|
||||
if i, err := os.Stat(docPath); err != nil {
|
||||
handleError(err)
|
||||
} else if !i.IsDir() {
|
||||
handleError(fmt.Errorf("expecting directory: %q", docPath))
|
||||
}
|
||||
|
||||
genDocs = true
|
||||
}
|
||||
|
||||
for {
|
||||
fileList = make([]string, 0, 100)
|
||||
|
||||
@@ -128,7 +148,7 @@ func Proc() {
|
||||
output("loaded %d store definitions from %s\n", len(storeSrc), storeSrcPath)
|
||||
|
||||
optionSrc = glob(optionSrcPath)
|
||||
output("loaded %d option defenitions from %s\n", len(optionSrc), optionSrcPath)
|
||||
output("loaded %d option definitions from %s\n", len(optionSrc), optionSrcPath)
|
||||
|
||||
if watchChanges {
|
||||
if watcher != nil {
|
||||
@@ -158,7 +178,9 @@ func Proc() {
|
||||
}
|
||||
|
||||
if actionDefs, err = procActions(actionSrc...); err == nil {
|
||||
err = genActions(tpls, actionDefs...)
|
||||
if genCode {
|
||||
err = genActions(tpls, actionDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "failed to process actions:\n") {
|
||||
@@ -166,7 +188,9 @@ func Proc() {
|
||||
}
|
||||
|
||||
if eventDefs, err = procEvents(eventSrc...); err == nil {
|
||||
err = genEvents(tpls, eventDefs...)
|
||||
if genCode {
|
||||
err = genEvents(tpls, eventDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "failed to process events:\n") {
|
||||
@@ -174,7 +198,9 @@ func Proc() {
|
||||
}
|
||||
|
||||
if typeDefs, err = procTypes(typeSrc...); err == nil {
|
||||
err = genTypes(tpls, typeDefs...)
|
||||
if genCode {
|
||||
err = genTypes(tpls, typeDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "failed to process types:\n") {
|
||||
@@ -182,7 +208,9 @@ func Proc() {
|
||||
}
|
||||
|
||||
if restDefs, err = procRest(restSrc...); err == nil {
|
||||
err = genRest(tpls, restDefs...)
|
||||
if genCode {
|
||||
err = genRest(tpls, restDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "failed to process rest:\n") {
|
||||
@@ -190,7 +218,9 @@ func Proc() {
|
||||
}
|
||||
|
||||
if storeDefs, err = procStore(storeSrc...); err == nil {
|
||||
err = genStore(tpls, storeDefs...)
|
||||
if genCode {
|
||||
err = genStore(tpls, storeDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "failed to process store:\n") {
|
||||
@@ -198,7 +228,13 @@ func Proc() {
|
||||
}
|
||||
|
||||
if optionDefs, err = procOptions(optionSrc...); err == nil {
|
||||
err = genOptions(tpls, optionDefs...)
|
||||
if genCode {
|
||||
err = genOptions(tpls, optionDefs...)
|
||||
}
|
||||
|
||||
if genDocs && err == nil {
|
||||
err = genOptionsDocs(tpls, docPath+docPathOptions, optionDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
if outputErr(err, "fail to process options:\n") {
|
||||
|
||||
@@ -2,6 +2,7 @@ package codegen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cortezaproject/corteza-server/pkg/slice"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
@@ -18,6 +19,11 @@ type (
|
||||
|
||||
Name string
|
||||
|
||||
Docs struct {
|
||||
Title string
|
||||
Intro string
|
||||
}
|
||||
|
||||
// List of imports
|
||||
// Used only by generated file and not pre-generated-user-file
|
||||
Imports []string `yaml:"imports"`
|
||||
@@ -28,10 +34,11 @@ type (
|
||||
optionsPropSet []*optionsProp
|
||||
|
||||
optionsProp struct {
|
||||
Name string
|
||||
Type string
|
||||
Env string
|
||||
Default *optionsPropDefault
|
||||
Name string
|
||||
Type string
|
||||
Env string
|
||||
Default *optionsPropDefault
|
||||
|
||||
Description string
|
||||
}
|
||||
|
||||
@@ -54,7 +61,15 @@ func procOptions(mm ...string) (dd []*optionsDef, err error) {
|
||||
|
||||
defer f.Close()
|
||||
|
||||
d = &optionsDef{}
|
||||
fname := path.Base(m)
|
||||
|
||||
d = &optionsDef{
|
||||
Name: fname[:len(fname)-len(path.Ext(fname))],
|
||||
}
|
||||
|
||||
if d.Docs.Title == "" {
|
||||
d.Docs.Title = d.Name
|
||||
}
|
||||
|
||||
if err := yaml.NewDecoder(f).Decode(d); err != nil {
|
||||
return err
|
||||
@@ -107,33 +122,45 @@ func (o optionsDef) Package() string {
|
||||
|
||||
func genOptions(tpl *template.Template, dd ...*optionsDef) (err error) {
|
||||
var (
|
||||
tplOptionsGen = tpl.Lookup("options.gen.go.tpl")
|
||||
|
||||
tplOptionsAdoc = tpl.Lookup("options.gen.adoc.tpl")
|
||||
tplOptions = tpl.Lookup("options.gen.go.tpl")
|
||||
|
||||
dst string
|
||||
)
|
||||
|
||||
for _, d := range dd {
|
||||
dst = path.Join(d.outputDir, path.Base(d.Source)[:strings.LastIndex(path.Base(d.Source), ".")]+".gen.go")
|
||||
err = goTemplate(dst, tplOptionsGen, d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
dst = path.Join(d.outputDir, path.Base(d.Source)[:strings.LastIndex(path.Base(d.Source), ".")]+".adoc")
|
||||
err = goTemplate(dst, tplOptionsAdoc, d)
|
||||
err = goTemplate(dst, tplOptions, d)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// for _, d := range dd {
|
||||
// dst = path.Join(d.outputDir, path.Base(d.Source)[:strings.LastIndex(path.Base(d.Source), ".")]+".adoc")
|
||||
// err = goTemplate(dst, tplOptionsAdoc, d)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func genOptionsDocs(tpl *template.Template, docsPath string, dd ...*optionsDef) (err error) {
|
||||
var (
|
||||
tplOptionsAdoc = tpl.Lookup("options.gen.adoc.tpl")
|
||||
|
||||
dst string
|
||||
)
|
||||
|
||||
dst = path.Join(docsPath, "option_env_variables_gen.adoc")
|
||||
return plainTemplate(dst, tplOptionsAdoc, map[string]interface{}{
|
||||
"Definitions": dd,
|
||||
"Import": collectOptionsDefImports("", dd...),
|
||||
})
|
||||
}
|
||||
|
||||
func collectOptionsDefImports(basePkg string, dd ...*optionsDef) []string {
|
||||
ii := make([]string, 0, len(dd))
|
||||
for _, d := range dd {
|
||||
for _, i := range d.Imports {
|
||||
if !slice.HasString(ii, i) && (basePkg == "" || !strings.HasSuffix(i, basePkg)) {
|
||||
ii = append(ii, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ii
|
||||
}
|
||||
|
||||
@@ -44,27 +44,29 @@ func goTemplate(dst string, tpl *template.Template, payload interface{}) (err er
|
||||
return nil
|
||||
}
|
||||
|
||||
func WritePlainTo(tpl *template.Template, payload interface{}, tplName, dst string) {
|
||||
func plainTemplate(dst string, tpl *template.Template, payload interface{}) (err error) {
|
||||
var output io.WriteCloser
|
||||
buf := bytes.Buffer{}
|
||||
|
||||
if err := tpl.ExecuteTemplate(&buf, tplName, payload); err != nil {
|
||||
handleError(err)
|
||||
} else {
|
||||
if dst == "" || dst == "-" {
|
||||
output = os.Stdout
|
||||
} else {
|
||||
if output, err = os.Create(dst); err != nil {
|
||||
handleError(err)
|
||||
}
|
||||
|
||||
defer output.Close()
|
||||
}
|
||||
|
||||
if _, err := output.Write(buf.Bytes()); err != nil {
|
||||
handleError(err)
|
||||
}
|
||||
if err := tpl.Execute(&buf, payload); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if dst == "" || dst == "-" {
|
||||
output = os.Stdout
|
||||
} else {
|
||||
if output, err = os.Create(dst); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer output.Close()
|
||||
}
|
||||
|
||||
if _, err := output.Write(buf.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func camelCase(pp ...string) (out string) {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/DB.yaml
|
||||
|
||||
= DB
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *DB_DSN*
|
||||
|`string`
|
||||
|"sqlite3://file::memory:?cache=shared&mode=memory"|Database connection string.
|
||||
|===
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
name: DB
|
||||
docs:
|
||||
title: Connection to data store backend
|
||||
|
||||
props:
|
||||
- name: DSN
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/HTTPClient.yaml
|
||||
|
||||
= HTTPClient
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *HTTP_CLIENT_TSL_INSECURE*
|
||||
|`bool`
|
||||
|false|Allow insecure (invalid, expired TSL/SSL certificates) connections.
|
||||
[IMPORTANT]
|
||||
We strongly recommend keeping this value set to false except for local development or demos.
|
||||
|
||||
3+| *HTTP_CLIENT_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|30 * time.Second|Default timeout for clients.
|
||||
|===
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
name: HTTPClient
|
||||
|
||||
imports:
|
||||
- time
|
||||
|
||||
docs:
|
||||
title: HTTP Client
|
||||
|
||||
props:
|
||||
- name: clientTSLInsecure
|
||||
type: bool
|
||||
@@ -13,7 +13,7 @@ props:
|
||||
Allow insecure (invalid, expired TSL/SSL certificates) connections.
|
||||
[IMPORTANT]
|
||||
We strongly recommend keeping this value set to false except for local development or demos.
|
||||
|
||||
|
||||
- name: httpClientTimeout
|
||||
type: time.Duration
|
||||
env: HTTP_CLIENT_TIMEOUT
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/HTTPServer.yaml
|
||||
|
||||
= HTTPServer
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *HTTP_ADDR*
|
||||
|`string`
|
||||
|":80"|IP and port for the HTTP server.
|
||||
3+| *HTTP_LOG_REQUEST*
|
||||
|`bool`
|
||||
|false|Log HTTP requests.
|
||||
3+| *HTTP_LOG_RESPONSE*
|
||||
|`bool`
|
||||
|false|Log HTTP responses.
|
||||
3+| *HTTP_ERROR_TRACING*
|
||||
|`bool`
|
||||
|false|
|
||||
3+| *HTTP_ENABLE_HEALTHCHECK_ROUTE*
|
||||
|`bool`
|
||||
|true|
|
||||
3+| *HTTP_ENABLE_VERSION_ROUTE*
|
||||
|`bool`
|
||||
|true|Enable `/version` route.
|
||||
3+| *HTTP_ENABLE_DEBUG_ROUTE*
|
||||
|`bool`
|
||||
|false|Enable `/debug` route.
|
||||
3+| *HTTP_METRICS*
|
||||
|`bool`
|
||||
|false|Enable (prometheus) metrics.
|
||||
3+| *HTTP_METRICS_NAME*
|
||||
|`string`
|
||||
|"corteza"|Name for metrics endpoint.
|
||||
3+| *HTTP_METRICS_USERNAME*
|
||||
|`string`
|
||||
|"metrics"|Username for the metrics endpoint.
|
||||
3+| *HTTP_METRICS_PASSWORD*
|
||||
|`string`
|
||||
|string(rand.Bytes(5))|Password for the metrics endpoint.
|
||||
3+| *HTTP_REPORT_PANIC*
|
||||
|`bool`
|
||||
|true|Report HTTP panic to Sentry.
|
||||
3+| *HTTP_API_ENABLED*
|
||||
|`bool`
|
||||
|true|
|
||||
3+| *HTTP_API_BASE_URL*
|
||||
|`string`
|
||||
||
|
||||
3+| *HTTP_WEBAPP_ENABLED*
|
||||
|`bool`
|
||||
|false|
|
||||
3+| *HTTP_WEBAPP_BASE_URL*
|
||||
|`string`
|
||||
|"/"|
|
||||
3+| *HTTP_WEBAPP_BASE_DIR*
|
||||
|`string`
|
||||
|"webapp/public"|
|
||||
3+| *HTTP_WEBAPP_LIST*
|
||||
|`string`
|
||||
|"admin,auth,messaging,compose"|
|
||||
|===
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
name: HTTPServer
|
||||
|
||||
imports:
|
||||
- github.com/cortezaproject/corteza-server/pkg/rand
|
||||
|
||||
docs:
|
||||
title: HTTP Server
|
||||
|
||||
props:
|
||||
- name: addr
|
||||
env: HTTP_ADDR
|
||||
@@ -15,7 +15,7 @@ props:
|
||||
env: HTTP_LOG_REQUEST
|
||||
default: false
|
||||
description: Log HTTP requests.
|
||||
|
||||
|
||||
- name: logResponse
|
||||
type: bool
|
||||
env: HTTP_LOG_RESPONSE
|
||||
@@ -26,22 +26,20 @@ props:
|
||||
type: bool
|
||||
env: HTTP_ERROR_TRACING
|
||||
default: false
|
||||
description:
|
||||
|
||||
|
||||
- name: enableHealthcheckRoute
|
||||
type: bool
|
||||
env: HTTP_ENABLE_HEALTHCHECK_ROUTE
|
||||
default: true
|
||||
description:
|
||||
|
||||
- name: enableVersionRoute
|
||||
- name: enableVersionRoute
|
||||
type: bool
|
||||
env: HTTP_ENABLE_VERSION_ROUTE
|
||||
default: true
|
||||
description: Enable `/version` route.
|
||||
|
||||
- name: enableDebugRoute
|
||||
- name: enableDebugRoute
|
||||
type: bool
|
||||
env: HTTP_ENABLE_DEBUG_ROUTE
|
||||
default: false
|
||||
@@ -73,34 +71,28 @@ props:
|
||||
env: HTTP_REPORT_PANIC
|
||||
default: true
|
||||
description: Report HTTP panic to Sentry.
|
||||
|
||||
|
||||
- name: apiEnabled
|
||||
type: bool
|
||||
env: HTTP_API_ENABLED
|
||||
default: true
|
||||
description:
|
||||
|
||||
- name: apiBaseUrl
|
||||
env: HTTP_API_BASE_URL
|
||||
description:
|
||||
|
||||
- name: webappEnabled
|
||||
type: bool
|
||||
env: HTTP_WEBAPP_ENABLED
|
||||
default: false
|
||||
description:
|
||||
|
||||
- name: webappBaseUrl
|
||||
env: HTTP_WEBAPP_BASE_URL
|
||||
default: "/"
|
||||
description:
|
||||
|
||||
- name: webappBaseDir
|
||||
env: HTTP_WEBAPP_BASE_DIR
|
||||
default: "webapp/public"
|
||||
description:
|
||||
|
||||
|
||||
- name: webappList
|
||||
env: HTTP_WEBAPP_LIST
|
||||
default: "admin,auth,messaging,compose"
|
||||
description:
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Options YAML integration
|
||||
|
||||
This file is meant to help with the creation of a .YAML file inside options package.
|
||||
|
||||
The name of the *.YAML* will dedicate the name of the *.gen.go* file e.g. fileName1.yaml -> fileName1.gen.go, filename2.yaml -> filename2.gen.go
|
||||
|
||||
The contents of the *.YAML* file should look like this:
|
||||
|
||||
name: ...
|
||||
|
||||
imports:
|
||||
- ...
|
||||
|
||||
props
|
||||
- name: ...
|
||||
type: ...
|
||||
env: ...
|
||||
default: ...
|
||||
description: ...
|
||||
|
||||
|
||||
|
||||
**name**: ::
|
||||
* It is the name of the struct
|
||||
|
||||
**imports**: ::
|
||||
* The list of imports that are needed, if there are no imporsts you may skip this step
|
||||
|
||||
**props**: ::
|
||||
* *name* -> name of variable
|
||||
* *type* -> the type of variable if not given it is "string" by default
|
||||
* *env* -> environment value that if it is not defined will be auto generated from "name" and "props: - name"
|
||||
* *default* -> the default value that is asigned to the "prop" strings should be given in double quotations if they are to be qouted
|
||||
* *description* -> description contains the "comment" for the entire prop line
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/SMTP.yaml
|
||||
|
||||
= SMTP
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *SMTP_HOST*
|
||||
|`string`
|
||||
|"localhost"|The SMTP server hostname.
|
||||
|
||||
3+| *SMTP_PORT*
|
||||
|`int`
|
||||
|25|The SMTP post.
|
||||
3+| *SMTP_USER*
|
||||
|`string`
|
||||
||The SMTP username.
|
||||
3+| *SMTP_PASS*
|
||||
|`string`
|
||||
||The SMTP password.
|
||||
3+| *SMTP_FROM*
|
||||
|`string`
|
||||
||The SMTP `from` email parameter
|
||||
3+| *SMTP_TLS_INSECURE*
|
||||
|`bool`
|
||||
|false|Allow insecure (invalid, expired TLS certificates) connections.
|
||||
3+| *SMTP_TLS_SERVER_NAME*
|
||||
|`string`
|
||||
||
|
||||
|===
|
||||
@@ -1,16 +1,18 @@
|
||||
|
||||
name: SMTP
|
||||
docs:
|
||||
title: Email sending
|
||||
intro: |
|
||||
Configure your local SMTP server or use one of the available providers
|
||||
|
||||
props:
|
||||
- name: host
|
||||
default: "localhost"
|
||||
description: |
|
||||
The SMTP server hostname.
|
||||
The SMTP server hostname.
|
||||
|
||||
- name: port
|
||||
type: int
|
||||
default: 25
|
||||
description: The SMTP post.
|
||||
description: The SMTP post.
|
||||
|
||||
- name: user
|
||||
description: The SMTP username.
|
||||
@@ -27,4 +29,3 @@ props:
|
||||
description: Allow insecure (invalid, expired TLS certificates) connections.
|
||||
|
||||
- name: tlsServerName
|
||||
description:
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/actionLog.yaml
|
||||
|
||||
= ActionLog
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *ACTIONLOG_ENABLED*
|
||||
|`bool`
|
||||
|true|Enable action logging.
|
||||
3+| *ACTIONLOG_DEBUG*
|
||||
|`bool`
|
||||
|false|Enable debug action logging.
|
||||
|===
|
||||
@@ -1,13 +1,15 @@
|
||||
|
||||
name: actionLog
|
||||
docs:
|
||||
title: Actionlog
|
||||
|
||||
props:
|
||||
- name: enabled
|
||||
type: bool
|
||||
default: true
|
||||
description: Enable action logging.
|
||||
|
||||
docs:
|
||||
description: Enable action logging.
|
||||
|
||||
- name: debug
|
||||
type: bool
|
||||
default: false
|
||||
description: Enable debug action logging.
|
||||
docs:
|
||||
description: Enable debug action logging.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/auth.yaml
|
||||
|
||||
= Auth
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *AUTH_JWT_SECRET*
|
||||
|`string`
|
||||
||Secret used for signing JWT tokens.
|
||||
[IMPORTANT]
|
||||
Make sure to provide a secret. If you don’t, a random value is assigned — this causes all of the tokens to become invalid after a server restart.
|
||||
|
||||
3+| *AUTH_JWT_EXPIRY*
|
||||
|`time.Duration`
|
||||
|time.Hour * 24 * 30|Experation time for the auth JWT tokens.
|
||||
|===
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
name: auth
|
||||
|
||||
imports:
|
||||
- time
|
||||
#- github.com/cortezaproject/corteza-server/pkg/rand
|
||||
|
||||
docs:
|
||||
title: Authentication
|
||||
|
||||
props:
|
||||
- name: secret
|
||||
@@ -11,8 +10,12 @@ props:
|
||||
description: |
|
||||
Secret used for signing JWT tokens.
|
||||
[IMPORTANT]
|
||||
Make sure to provide a secret. If you don’t, a random value is assigned — this causes all of the tokens to become invalid after a server restart.
|
||||
|
||||
====
|
||||
Make sure to provide a secret.
|
||||
If you don't, a random value is assigned -- this causes all of the tokens to become invalid after a server restart.
|
||||
====
|
||||
|
||||
|
||||
- name: expiry
|
||||
type: time.Duration
|
||||
env: AUTH_JWT_EXPIRY
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/corredor.yaml
|
||||
|
||||
= Corredor
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *CORREDOR_ENABLED*
|
||||
|`bool`
|
||||
|true|Enable/disable Corredor integration
|
||||
3+| *CORREDOR_ADDR*
|
||||
|`string`
|
||||
|"localhost:50051"|Hostname and port of the Corredor gRPC server.
|
||||
3+| *CORREDOR_MAX_BACKOFF_DELAY*
|
||||
|`time.Duration`
|
||||
|time.Minute|Max delay for backoff on connection.
|
||||
3+| *CORREDOR_MAX_RECEIVE_MESSAGE_SIZE*
|
||||
|`int`
|
||||
|2 << 23|Max message size that can be recived.
|
||||
3+| *CORREDOR_DEFAULT_EXEC_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|time.Minute|
|
||||
3+| *CORREDOR_LIST_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|time.Second * 2|
|
||||
3+| *CORREDOR_LIST_REFRESH*
|
||||
|`time.Duration`
|
||||
|time.Second * 5|
|
||||
3+| *CORREDOR_RUN_AS_ENABLED*
|
||||
|`bool`
|
||||
|true|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_ENABLED*
|
||||
|`bool`
|
||||
|false|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_PATH*
|
||||
|`string`
|
||||
|"/certs/corredor/client"|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_CA*
|
||||
|`string`
|
||||
|"ca.crt"|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_PRIVATE*
|
||||
|`string`
|
||||
|"private.key"|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_PUBLIC*
|
||||
|`string`
|
||||
|"public.crt"|
|
||||
3+| *CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME*
|
||||
|`string`
|
||||
||
|
||||
|===
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
name: corredor
|
||||
|
||||
imports:
|
||||
- "time"
|
||||
|
||||
docs:
|
||||
title: Connection to Corredor
|
||||
|
||||
props:
|
||||
- name: enabled
|
||||
type: bool
|
||||
@@ -23,7 +23,7 @@ props:
|
||||
type: int
|
||||
default: 2 << 23
|
||||
description: Max message size that can be recived.
|
||||
|
||||
|
||||
- name: defaultExecTimeout
|
||||
type: time.Duration
|
||||
default: time.Minute
|
||||
@@ -44,22 +44,22 @@ props:
|
||||
type: bool
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_ENABLED
|
||||
default: false
|
||||
|
||||
|
||||
- name: tlsCertPath
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_PATH
|
||||
default: "/certs/corredor/client"
|
||||
|
||||
|
||||
- name: tlsCertCA
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_CA
|
||||
default: "ca.crt"
|
||||
|
||||
|
||||
- name: tlsCertPrivate
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_PRIVATE
|
||||
default: "private.key"
|
||||
|
||||
|
||||
- name: tlsCertPublic
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_PUBLIC
|
||||
default: "public.crt"
|
||||
|
||||
|
||||
- name: tlsServerName
|
||||
env: CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/environment.yaml
|
||||
|
||||
= Environment
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *ENVIRONMENT*
|
||||
|`string`
|
||||
|"production"|
|
||||
|===
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
name: environment
|
||||
docs:
|
||||
title: Environment
|
||||
|
||||
props:
|
||||
- name: environment
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/eventbus.yaml
|
||||
|
||||
= Eventbus
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *EVENTBUS_SCHEDULER_ENABLED*
|
||||
|`bool`
|
||||
|true|Enable eventbus sheduler.
|
||||
3+| *EVENTBUS_SCHEDULER_INTERVAL*
|
||||
|`time.Duration`
|
||||
|time.Minute|Set time interval for `eventbus` scheduler.
|
||||
|===
|
||||
@@ -1,8 +1,9 @@
|
||||
name: eventbus
|
||||
|
||||
imports:
|
||||
- time
|
||||
|
||||
docs:
|
||||
title: Events and scheduler
|
||||
|
||||
props:
|
||||
- name: schedulerEnabled
|
||||
type: bool
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/monitor.yaml
|
||||
|
||||
= Monitor
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *MONITOR_INTERVAL*
|
||||
|`time.Duration`
|
||||
|300 * time.Second|Output (log) interval for monitoring.
|
||||
|===
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
name: monitor
|
||||
|
||||
imports:
|
||||
- time
|
||||
|
||||
docs:
|
||||
title: Monitoring
|
||||
|
||||
props:
|
||||
- name: interval
|
||||
type: time.Duration
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/objectStore.yaml
|
||||
|
||||
= ObjectStore
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *STORAGE_PATH*
|
||||
|`string`
|
||||
|"var/store"|Location where uploaded files are stored.
|
||||
3+| *MINIO_ENDPOINT*
|
||||
|`string`
|
||||
||
|
||||
3+| *MINIO_SECURE*
|
||||
|`bool`
|
||||
|true|
|
||||
3+| *MINIO_ACCESS_KEY*
|
||||
|`string`
|
||||
||
|
||||
3+| *MINIO_SECRET_KEY*
|
||||
|`string`
|
||||
||
|
||||
3+| *MINIO_SSEC_KEY*
|
||||
|`string`
|
||||
||
|
||||
3+| *MINIO_BUCKET*
|
||||
|`string`
|
||||
||
|
||||
3+| *MINIO_STRICT*
|
||||
|`bool`
|
||||
|false|
|
||||
|===
|
||||
@@ -1,34 +1,36 @@
|
||||
|
||||
name: objectStore
|
||||
docs:
|
||||
title: Object (file) storage
|
||||
intro:
|
||||
The MinIO integration allows you to replace local storage with cloud storage.
|
||||
When configured, `STORAGE_PATH` is not needed.
|
||||
|
||||
props:
|
||||
- name: path
|
||||
env: STORAGE_PATH
|
||||
default: "var/store"
|
||||
description: Location where uploaded files are stored.
|
||||
|
||||
- name: minioEndpoint
|
||||
|
||||
- name: minioEndpoint
|
||||
env: MINIO_ENDPOINT
|
||||
description:
|
||||
|
||||
- name: minioSecure
|
||||
type: bool
|
||||
|
||||
- name: minioSecure
|
||||
type: bool
|
||||
env: MINIO_SECURE
|
||||
default: true
|
||||
|
||||
- name: minioAccessKey
|
||||
|
||||
- name: minioAccessKey
|
||||
env: MINIO_ACCESS_KEY
|
||||
|
||||
- name: minioSecretKey
|
||||
|
||||
- name: minioSecretKey
|
||||
env: MINIO_SECRET_KEY
|
||||
|
||||
- name: minioSSECKey
|
||||
|
||||
- name: minioSSECKey
|
||||
env: MINIO_SSEC_KEY
|
||||
|
||||
- name: minioBucket
|
||||
|
||||
- name: minioBucket
|
||||
env: MINIO_BUCKET
|
||||
|
||||
- name: minioStrict
|
||||
type: bool
|
||||
|
||||
- name: minioStrict
|
||||
type: bool
|
||||
env: MINIO_STRICT
|
||||
default: false
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/provision.yaml
|
||||
|
||||
= Provision
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *PROVISION_ALWAYS*
|
||||
|`bool`
|
||||
|true|Controls if provision should run when the server starts.
|
||||
|===
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
name: provision
|
||||
docs:
|
||||
title: Provisioning
|
||||
|
||||
props:
|
||||
- name: always
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/sentry.yaml
|
||||
|
||||
= Sentry
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *SENTRY_DSN*
|
||||
|`string`
|
||||
||Set to enable Sentry client.
|
||||
3+| *SENTRY_DEBUG*
|
||||
|`bool`
|
||||
||Print out debugging information.
|
||||
3+| *SENTRY_ATTACH_STACKTRACE*
|
||||
|`bool`
|
||||
|true|Attach stacktraces
|
||||
3+| *SENTRY_SAMPLE_RATE*
|
||||
|`float32`
|
||||
||Sample rate for event submission (0.0 - 1.0. defaults to 1.0)
|
||||
3+| *SENTRY_MAX_BREADCRUMBS*
|
||||
|`int`
|
||||
|0|Maximum number of bredcrumbs.
|
||||
3+| *SENTRY_SERVERNAME*
|
||||
|`string`
|
||||
||Set reported Server name.
|
||||
3+| *SENTRY_RELEASE*
|
||||
|`string`
|
||||
|version.Version|Set reported Release.
|
||||
3+| *SENTRY_DIST*
|
||||
|`string`
|
||||
||Set reported distribution.
|
||||
3+| *SENTRY_ENVIRONMENT*
|
||||
|`string`
|
||||
||Set reported environment.
|
||||
|===
|
||||
@@ -1,9 +1,17 @@
|
||||
|
||||
name: sentry
|
||||
|
||||
imports:
|
||||
- github.com/cortezaproject/corteza-server/pkg/version
|
||||
|
||||
|
||||
docs:
|
||||
title: Sentry monitoring
|
||||
intro: |
|
||||
[NOTE]
|
||||
====
|
||||
These parameters help in the development and testing process.
|
||||
When you are deploying to production, these should be disabled to improve performance and reduce storage usage.
|
||||
|
||||
You should configure external services such as Sentry or ELK to keep track of logs and error reports.
|
||||
====
|
||||
|
||||
props:
|
||||
- name: DSN
|
||||
description: Set to enable Sentry client.
|
||||
@@ -36,6 +44,6 @@ props:
|
||||
|
||||
- name: dist
|
||||
description: Set reported distribution.
|
||||
|
||||
|
||||
- name: environment
|
||||
description: Set reported environment.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/upgrade.yaml
|
||||
|
||||
= Upgrade
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *UPGRADE_DEBUG*
|
||||
|`bool`
|
||||
|false|Enable/disable debug logging.
|
||||
To enable debug logging set `UPGRADE_DEBUG=true`.
|
||||
|
||||
3+| *UPGRADE_ALWAYS*
|
||||
|`bool`
|
||||
|true|Controls if the upgradable systems should
|
||||
be upgraded when the server starts.
|
||||
|===
|
||||
@@ -1,17 +1,17 @@
|
||||
|
||||
name: upgrade
|
||||
docs:
|
||||
title: Data store (database) upgrade
|
||||
|
||||
props:
|
||||
- name: Debug
|
||||
- name: Debug
|
||||
type: bool
|
||||
default: false
|
||||
description: |
|
||||
Enable/disable debug logging.
|
||||
To enable debug logging set `UPGRADE_DEBUG=true`.
|
||||
|
||||
|
||||
- name: Always
|
||||
type: bool
|
||||
default: true
|
||||
description: |
|
||||
Controls if the upgradable systems should
|
||||
be upgraded when the server starts.
|
||||
be upgraded when the server starts.
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/waitFor.yaml
|
||||
|
||||
= WaitFor
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *WAIT_FOR*
|
||||
|`time.Duration`
|
||||
|0|Delays API startup for the amount of time specified (10s, 2m...).
|
||||
This delay happens before service (`WAIT_FOR_SERVICES`) probing.
|
||||
|
||||
3+| *WAIT_FOR_STATUS_PAGE*
|
||||
|`bool`
|
||||
|true|Show temporary status web page.
|
||||
3+| *WAIT_FOR_SERVICES*
|
||||
|`string`
|
||||
||Space delimited list of hosts and/or URLs to probe. Host format: `host` or
|
||||
`host:443` (port will default to 80).
|
||||
|
||||
Services are probed in parallel.
|
||||
|
||||
3+| *WAIT_FOR_SERVICES_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|time.Minute|Max time for each service probe.
|
||||
3+| *WAIT_FOR_SERVICES_PROBE_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|time.Second * 30|Timeout for each service probe.
|
||||
3+| *WAIT_FOR_SERVICES_PROBE_INTERVAL*
|
||||
|`time.Duration`
|
||||
|time.Second * 5|Interval between service probes.
|
||||
|===
|
||||
@@ -1,46 +1,54 @@
|
||||
|
||||
name: waitFor
|
||||
|
||||
imports:
|
||||
- time
|
||||
|
||||
docs:
|
||||
title: Delay system startup
|
||||
intro:
|
||||
You can configure these options to defer API execution until another external (HTTP) service is up and running.
|
||||
|
||||
[ TIP ]
|
||||
====
|
||||
Delaying API execution can come in handy in complex setups where execution order is important.
|
||||
====
|
||||
|
||||
|
||||
props:
|
||||
- name: Delay
|
||||
type: time.Duration
|
||||
- name: Delay
|
||||
type: time.Duration
|
||||
env: WAIT_FOR
|
||||
default: 0
|
||||
description: |
|
||||
Delays API startup for the amount of time specified (10s, 2m...).
|
||||
This delay happens before service (`WAIT_FOR_SERVICES`) probing.
|
||||
|
||||
- name: StatusPage
|
||||
type: bool
|
||||
- name: StatusPage
|
||||
type: bool
|
||||
env: WAIT_FOR_STATUS_PAGE
|
||||
default: true
|
||||
description: Show temporary status web page.
|
||||
|
||||
- name: Services
|
||||
- name: Services
|
||||
env: WAIT_FOR_SERVICES
|
||||
description: |
|
||||
Space delimited list of hosts and/or URLs to probe. Host format: `host` or
|
||||
Space delimited list of hosts and/or URLs to probe. Host format: `host` or
|
||||
`host:443` (port will default to 80).
|
||||
|
||||
|
||||
Services are probed in parallel.
|
||||
|
||||
- name: ServicesTimeout
|
||||
type: time.Duration
|
||||
- name: ServicesTimeout
|
||||
type: time.Duration
|
||||
env: WAIT_FOR_SERVICES_TIMEOUT
|
||||
default: time.Minute
|
||||
description: Max time for each service probe.
|
||||
|
||||
- name: ServicesProbeTimeout
|
||||
type: time.Duration
|
||||
- name: ServicesProbeTimeout
|
||||
type: time.Duration
|
||||
env: WAIT_FOR_SERVICES_PROBE_TIMEOUT
|
||||
default: time.Second * 30
|
||||
description: Timeout for each service probe.
|
||||
|
||||
- name: ServicesProbeInterval
|
||||
type: time.Duration
|
||||
|
||||
- name: ServicesProbeInterval
|
||||
type: time.Duration
|
||||
env: WAIT_FOR_SERVICES_PROBE_INTERVAL
|
||||
default: time.Second * 5
|
||||
description: Interval between service probes.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// This file is auto-generated.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// pkg/options/websocket.yaml
|
||||
|
||||
= Websocket
|
||||
|
||||
[cols="2,3,5a"]
|
||||
|===
|
||||
|Type|Default value|Description
|
||||
3+| *WEBSOCKET_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|15 * time.Second|Time before `WsServer` gets timed out.
|
||||
3+| *WEBSOCKET_PING_TIMEOUT*
|
||||
|`time.Duration`
|
||||
|120 * time.Second|
|
||||
3+| *WEBSOCKET_PING_PERIOD*
|
||||
|`time.Duration`
|
||||
|((120 * time.Second) * 9) / 10|
|
||||
|===
|
||||
@@ -1,21 +1,19 @@
|
||||
|
||||
name: websocket
|
||||
|
||||
imports:
|
||||
imports:
|
||||
- time
|
||||
|
||||
props:
|
||||
- name: Timeout
|
||||
docs:
|
||||
title: Websocket server
|
||||
|
||||
props:
|
||||
- name: Timeout
|
||||
type: time.Duration
|
||||
default: 15 * time.Second
|
||||
description: Time before `WsServer` gets timed out.
|
||||
|
||||
- name: PingTimeout
|
||||
- name: PingTimeout
|
||||
type: time.Duration
|
||||
default: 120 * time.Second
|
||||
description:
|
||||
|
||||
- name: PingPeriod
|
||||
- name: PingPeriod
|
||||
type: time.Duration
|
||||
default: ((120 * time.Second) * 9) / 10
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user