3
0

Ported options codegen to cue

This commit is contained in:
Denis Arh
2022-01-29 12:13:04 +01:00
parent cb34bad61a
commit a035e6106f
100 changed files with 2471 additions and 2518 deletions

View File

@@ -2,6 +2,7 @@ package app
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
"github.com/cortezaproject/corteza-server/app/options"
"github.com/cortezaproject/corteza-server/system"
"github.com/cortezaproject/corteza-server/compose"
"github.com/cortezaproject/corteza-server/automation"
@@ -9,7 +10,38 @@ import (
)
corteza: schema.#platform & {
ident: "corteza"
handle: "corteza"
"options": [
options.DB,
options.HTTPClient,
options.HTTPServer,
options.RBAC,
options.SCIM,
options.SMTP,
options.actionLog,
options.apigw,
options.auth,
options.corredor,
options.environment,
options.eventbus,
options.federation,
options.limit,
options.locale,
options.log,
options.messagebus,
options.monitor,
options.objectStore,
options.plugins,
options.provision,
options.seeder,
options.sentry,
options.template,
options.upgrade,
options.waitFor,
options.websocket,
options.workflow,
]
components: [
system.component,

View File

@@ -123,8 +123,8 @@ func (app *CortezaApp) Setup() (err error) {
}
http.SetupDefaults(
app.Opt.HTTPClient.HttpClientTimeout,
app.Opt.HTTPClient.ClientTSLInsecure,
app.Opt.HTTPClient.Timeout,
app.Opt.HTTPClient.TlsInsecure,
)
monitor.Setup(app.Log, app.Opt.Monitor)

16
app/options/DB.cue Normal file
View File

@@ -0,0 +1,16 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
DB: schema.#optionsGroup & {
handle: "DB"
options: {
DSN: {
default: "\"sqlite3://file::memory:?cache=shared&mode=memory\""
description: "Database connection string."
}
}
title: "Connection to data store backend"
}

View File

@@ -0,0 +1,40 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
HTTPClient: schema.#optionsGroup & {
title: "HTTP Client"
// Explicitly define all variants to be 100% compaltible with old name
handle: "http-client"
// @todo remove explcitly defined expIdent and adjust the code
expIdent: "HTTPClient"
imports: [
"\"time\"",
]
options: {
tls_insecure: {
type: "bool"
default: "false"
description: """
Allow insecure (invalid, expired TLS/SSL certificates) connections.
[IMPORTANT]
====
We strongly recommend keeping this value set to false except for local development or demos.
====
"""
}
timeout: {
type: "time.Duration"
default: "30 * time.Second"
description: "Default timeout for clients."
}
}
}

129
app/options/HTTPServer.cue Normal file
View File

@@ -0,0 +1,129 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
HTTPServer: schema.#optionsGroup & {
handle: "HTTPServer"
title: "HTTP Server"
imports: [
"\"github.com/cortezaproject/corteza-server/pkg/rand\"",
]
options: {
addr: {
default: "\":80\""
description: "IP and port for the HTTP server."
env: "HTTP_ADDR"
}
logRequest: {
type: "bool"
default: "false"
description: "Log HTTP requests."
env: "HTTP_LOG_REQUEST"
}
logResponse: {
type: "bool"
default: "false"
description: "Log HTTP responses."
env: "HTTP_LOG_RESPONSE"
}
tracing: {
type: "bool"
default: "false"
env: "HTTP_ERROR_TRACING"
}
enableHealthcheckRoute: {
type: "bool"
default: "true"
env: "HTTP_ENABLE_HEALTHCHECK_ROUTE"
}
enableVersionRoute: {
type: "bool"
default: "true"
description: "Enable `/version` route."
env: "HTTP_ENABLE_VERSION_ROUTE"
}
enableDebugRoute: {
type: "bool"
default: "false"
description: "Enable `/debug` route."
env: "HTTP_ENABLE_DEBUG_ROUTE"
}
enableMetrics: {
type: "bool"
default: "false"
description: "Enable (prometheus) metrics."
env: "HTTP_METRICS"
}
metricsServiceLabel: {
default: "\"corteza\""
description: "Name for metrics endpoint."
env: "HTTP_METRICS_NAME"
}
metricsUsername: {
default: "\"metrics\""
description: "Username for the metrics endpoint."
env: "HTTP_METRICS_USERNAME"
}
metricsPassword: {
default: "string(rand.Bytes(5))"
description: "Password for the metrics endpoint."
env: "HTTP_METRICS_PASSWORD"
}
enablePanicReporting: {
type: "bool"
default: "true"
description: "Report HTTP panic to Sentry."
env: "HTTP_REPORT_PANIC"
}
baseUrl: {
default: "\"/\""
description: "Base URL (prefix) for all routes (<baseUrl>/auth, <baseUrl>/api, ...)"
env: "HTTP_BASE_URL"
}
apiEnabled: {
type: "bool"
default: "true"
env: "HTTP_API_ENABLED"
}
apiBaseUrl: {
default: "\"/\""
description: """
When webapps are enabled (HTTP_WEBAPP_ENABLED) this is moved to '/api' if not explicitly set otherwise.
API base URL is internaly prefixed with baseUrl
"""
env: "HTTP_API_BASE_URL"
}
webappEnabled: {
type: "bool"
default: "false"
env: "HTTP_WEBAPP_ENABLED"
}
webappBaseUrl: {
default: "\"/\""
description: "Webapp base URL is internaly prefixed with baseUrl"
env: "HTTP_WEBAPP_BASE_URL"
}
webappBaseDir: {
default: "\"./webapp/public\""
env: "HTTP_WEBAPP_BASE_DIR"
}
webappList: {
default: "\"admin,compose,workflow,reporter\""
env: "HTTP_WEBAPP_LIST"
}
sslTerminated: {
type: "bool"
default: "isSecure()"
description: """
Is SSL termination enabled in ingres, proxy or load balancer that is in front of Corteza?
By default, Corteza checks for presence of LETSENCRYPT_HOST environmental variable.
This DOES NOT enable SSL termination in Cortreza!
"""
env: "HTTP_SSL_TERMINATED"
}
}
}

43
app/options/RBAC.cue Normal file
View File

@@ -0,0 +1,43 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
RBAC: schema.#optionsGroup & {
handle: "RBAC"
title: "RBAC options"
options: {
log: {
type: "bool"
description: "Log RBAC related events and actions"
}
service_user: {}
bypass_roles: {
default: "\"super-admin\""
description: """
Space delimited list of role handles.
These roles causes short-circuiting access control check and allowing all operations.
System will refuse to start if check-bypassing roles are also listed as authenticated or anonymous auto-assigned roles.
"""
}
authenticated_roles: {
default: "\"authenticated\""
description: """
Space delimited list of role handles.
These roles are automatically assigned to authenticated user.
Memberships can not be managed for these roles.
System will refuse to start if roles listed here are also listed under anonymous roles
"""
}
anonymous_roles: {
default: "\"anonymous\""
description: """
Space delimited list of role handles.
These roles are automatically assigned to anonymous user.
Memberships can not be managed for these roles.
"""
}
}
}

31
app/options/SCIM.cue Normal file
View File

@@ -0,0 +1,31 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
SCIM: schema.#optionsGroup & {
handle: "SCIM"
title: "SCIM Server"
options: {
enabled: {
type: "bool"
description: "Enable SCIM subsystem"
}
base_URL: {
default: "\"/scim\""
description: "Prefix for SCIM API endpoints"
}
secret: {
description: "Secret to use to validate requests on SCIM API endpoints"
}
external_id_as_primary: {
type: "bool"
description: "Use external IDs in SCIM API endpoints"
}
external_id_validation: {
default: "\"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$\""
description: "Validates format of external IDs. Defaults to UUID"
}
}
}

44
app/options/SMTP.cue Normal file
View File

@@ -0,0 +1,44 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
SMTP: schema.#optionsGroup & {
handle: "SMTP"
title: "Email sending"
intro: """
Configure your local SMTP server or use one of the available providers.
These values are copied to settings when the server starts and can be managed from the administration console.
We recommend you remove these values after they are copied to settings.
If server detects difference between these options and settings, it shows a warning in the log on server start.
"""
options: {
host: {
default: "\"localhost\""
description: "The SMTP server hostname."
}
port: {
type: "int"
default: "25"
description: "The SMTP post."
}
user: {
description: "The SMTP username."
}
pass: {
description: "The SMTP password."
}
from: {
description: "The SMTP `from` email parameter"
}
tls_insecure: {
type: "bool"
default: "false"
description: "Allow insecure (invalid, expired TLS certificates) connections."
}
tls_server_name: {}
}
}

24
app/options/actionLog.cue Normal file
View File

@@ -0,0 +1,24 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
actionLog: schema.#optionsGroup & {
handle: "actionLog"
options: {
enabled: {
type: "bool"
default: "true"
}
debug: {
type: "bool"
default: "false"
}
workflow_functions_enabled: {
type: "bool"
default: "false"
}
}
title: "Actionlog"
}

52
app/options/apigw.cue Normal file
View File

@@ -0,0 +1,52 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
apigw: schema.#optionsGroup & {
handle: "apigw"
imports: [
"\"time\"",
]
options: {
enabled: {
type: "bool"
default: "true"
description: "Enable API Gateway"
}
debug: {
type: "bool"
default: "false"
description: "Enable API Gateway debugging info"
}
log_enabled: {
type: "bool"
default: "false"
description: "Enable extra logging"
}
log_request_body: {
type: "bool"
default: "false"
description: "Enable incoming request body output in logs"
}
proxy_enable_debug_log: {
type: "bool"
default: "false"
description: "Enable full debug log on requests / responses - warning, includes sensitive data"
}
proxy_follow_redirects: {
type: "bool"
default: "true"
description: "Follow redirects on proxy requests"
}
proxy_outbound_timeout: {
type: "time.Duration"
default: "time.Second * 30"
description: "Outbound request timeout"
}
}
title: "API Gateway"
}

192
app/options/auth.cue Normal file
View File

@@ -0,0 +1,192 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
auth: schema.#optionsGroup & {
handle: "auth"
imports: [
"\"time\"",
]
options: {
log_enabled: {
type: "bool"
description: "Enable extra logging for authentication flows"
}
password_security: {
type: "bool"
default: "true"
description: """
Password security allows you to disable constraints to which passwords must conform to.
[CAUTION]
====
Disabling password security can be useful for development environments as it removes the need for complex passwords.
Password security *should be enabled* on production environments to avoid security incidents
====
"""
}
secret: {
default: "getSecretFromEnv(\"jwt secret\")"
description: """
Secret used for signing JWT tokens.
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
"""
env: "AUTH_JWT_SECRET"
}
access_token_lifetime: {
type: "time.Duration"
default: "time.Hour * 2"
description: "Access token lifetime"
env: "AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME"
}
refresh_token_lifetime: {
type: "time.Duration"
default: "time.Hour * 24 * 3"
description: "Refresh token lifetime"
env: "AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME"
}
expiry: {
type: "time.Duration"
default: "time.Hour * 24 * 30"
description: "Experation time for the auth JWT tokens."
env: "AUTH_JWT_EXPIRY"
}
external_redirect_URL: {
default: "fullURL(\"/auth/external/{provider}/callback\")"
description: """
Redirect URL to be sent with OAuth2 authentication request to provider
`provider` placeholder is replaced with the actual value when used.
"""
}
external_cookie_secret: {
default: "getSecretFromEnv(\"external cookie secret\")"
description: """
Secret used for securing cookies
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
"""
}
base_URL: {
default: "fullURL(\"/auth\")"
description: """
Frontend base URL. Must be an absolute URL, with the domain.
This is used for some redirects and links in auth emails.
"""
}
session_cookie_name: {
default: "\"session\""
description: "Session cookie name"
}
session_cookie_path: {
default: "pathPrefix(\"/auth\")"
description: "Session cookie path"
}
session_cookie_domain: {
default: "guessHostname()"
description: "Session cookie domain"
}
session_cookie_secure: {
type: "bool"
default: "isSecure()"
description: "Defaults to true when HTTPS is used. Corteza will try to guess the this setting by"
}
session_lifetime: {
type: "time.Duration"
default: "24 * time.Hour"
description: "How long do we keep the temporary session"
}
session_perm_lifetime: {
type: "time.Duration"
default: "360 * 24 * time.Hour"
description: "How long do we keep the permanent session"
}
garbage_collector_interval: {
type: "time.Duration"
default: "15 * time.Minute"
description: "How often are expired sessions and tokens purged from the database"
}
request_rate_limit: {
type: "int"
default: "60"
description: """
How many requests from a cerain IP address are allowed in a time window.
Set to zero to disable
"""
}
request_rate_window_length: {
type: "time.Duration"
default: "time.Minute"
description: "How many requests from a cerain IP address are allowed in a time window"
}
csrf_secret: {
default: "getSecretFromEnv(\"csrf secret\")"
description: """
Secret used for securing CSRF protection
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
"""
}
csrf_enabled: {
type: "bool"
default: "true"
description: "Enable CSRF protection"
}
csrf_field_name: {
default: "\"same-site-authenticity-token\""
description: "Form field name used for CSRF protection"
}
csrf_cookie_name: {
default: "\"same-site-authenticity-token\""
description: "Cookie name used for CSRF protection"
}
default_client: {
default: "\"corteza-webapp\""
description: """
Handle for OAuth2 client used for automatic redirect from /auth/oauth2/go endpoint.
This simplifies configuration for OAuth2 flow for Corteza Web applications as it removes
the need to suply redirection URL and client ID (oauth2/go endpoint does that internally)
"""
}
assets_path: {
default: ""
description: """
Path to js, css, images and template source files
When corteza starts, if path exists it tries to load template files from it.
If not it uses statically embedded files.
When empty path is set (default value), embedded files are used.
"""
}
development_mode: {
type: "bool"
description: """
When enabled, corteza reloads template before every execution.
Enable this for debugging or when developing auth templates.
Should be disabled in production where templates do not change between server restarts.
"""
}
}
title: "Authentication"
}

76
app/options/corredor.cue Normal file
View File

@@ -0,0 +1,76 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
corredor: schema.#optionsGroup & {
handle: "corredor"
imports: [
"\"time\"",
]
options: {
enabled: {
type: "bool"
default: "false"
description: "Enable/disable Corredor integration"
}
addr: {
default: "\"localhost:50051\""
description: "Hostname and port of the Corredor gRPC server."
}
max_backoff_delay: {
type: "time.Duration"
default: "time.Minute"
description: "Max delay for backoff on connection."
}
max_receive_message_size: {
type: "int"
default: "2 << 23"
description: "Max message size that can be recived."
}
default_exec_timeout: {
type: "time.Duration"
default: "time.Minute"
}
list_timeout: {
type: "time.Duration"
default: "time.Second * 2"
}
list_refresh: {
type: "time.Duration"
default: "time.Second * 5"
}
run_as_enabled: {
type: "bool"
default: "true"
}
tls_cert_enabled: {
type: "bool"
default: "false"
env: "CORREDOR_CLIENT_CERTIFICATES_ENABLED"
}
tls_cert_path: {
default: "\"/certs/corredor/client\""
env: "CORREDOR_CLIENT_CERTIFICATES_PATH"
}
tls_cert_cA: {
default: "\"ca.crt\""
env: "CORREDOR_CLIENT_CERTIFICATES_CA"
}
tls_cert_private: {
default: "\"private.key\""
env: "CORREDOR_CLIENT_CERTIFICATES_PRIVATE"
}
tls_cert_public: {
default: "\"public.crt\""
env: "CORREDOR_CLIENT_CERTIFICATES_PUBLIC"
}
tls_server_name: {
env: "CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME"
}
}
title: "Connection to Corredor"
}

View File

@@ -0,0 +1,16 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
environment: schema.#optionsGroup & {
handle: "environment"
options: {
environment: {
default: "\"production\""
env: "ENVIRONMENT"
}
}
title: "Environment"
}

27
app/options/eventbus.cue Normal file
View File

@@ -0,0 +1,27 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
eventbus: schema.#optionsGroup & {
handle: "eventbus"
imports: [
"\"time\"",
]
options: {
scheduler_enabled: {
type: "bool"
default: "true"
description: "Enable eventbus sheduler."
}
scheduler_interval: {
type: "time.Duration"
default: "time.Minute"
description: "Set time interval for `eventbus` scheduler."
}
}
title: "Events and scheduler"
}

View File

@@ -0,0 +1,55 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
federation: schema.#optionsGroup & {
handle: "federation"
imports: [
"\"time\"",
]
options: {
enabled: {
type: "bool"
default: "false"
description: "Federation enabled on system, it toggles rest API endpoints, possibility to map modules in Compose and sync itself"
}
label: {
type: "string"
default: "\"federated\""
description: "Federation label"
}
host: {
type: "string"
default: "\"local.cortezaproject.org\""
description: "Host that is used during node pairing, also included in invitation"
}
structure_monitor_interval: {
type: "time.Duration"
default: "time.Minute * 2"
description: "Delay in seconds for structure sync"
env: "FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL"
}
structure_page_size: {
type: "int"
default: "1"
description: "Bulk size in fetching for structure sync"
env: "FEDERATION_SYNC_STRUCTURE_PAGE_SIZE"
}
data_monitor_interval: {
type: "time.Duration"
default: "time.Second * 60"
description: "Delay in seconds for data sync"
env: "FEDERATION_SYNC_DATA_MONITOR_INTERVAL"
}
data_page_size: {
type: "int"
default: "100"
description: "Bulk size in fetching for data sync"
env: "FEDERATION_SYNC_DATA_PAGE_SIZE"
}
}
}

16
app/options/limit.cue Normal file
View File

@@ -0,0 +1,16 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
limit: schema.#optionsGroup & {
handle: "limit"
options: {
system_users: {
type: "int"
description: "Maximum number of valid (not deleted, not suspended) users"
}
}
title: "Limits"
}

53
app/options/locale.cue Normal file
View File

@@ -0,0 +1,53 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
locale: schema.#optionsGroup & {
handle: "locale"
options: {
languages: {
default: "\"en\""
description: """
List of compa delimited languages (language tags) to enable.
In case when an enabled language can not be loaded, error is logged.
When loading language configurations (config.xml) from the configured path(s).
"""
}
path: {
description: "One or more paths to locale config and translation files, separated by colon"
}
query_string_param: {
default: "\"lng\""
description: """
Name of the query string parameter used to pass the language tag (it overrides Accept-Language header).
Set it to empty string to disable detection from the query string.
This parameter is ignored if only one language is enabled
"""
}
resource_translations_enabled: {
type: "bool"
description: "When enabled, Corteza all"
}
log: {
type: "bool"
description: "Log locale related events and actions"
}
development_mode: {
type: "bool"
description: """
When enabled, Corteza reloads language files on every request
Enable this for debugging or developing.
"""
}
}
}

68
app/options/log.cue Normal file
View File

@@ -0,0 +1,68 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
log: schema.#optionsGroup & {
handle: "log"
options: {
debug: {
type: "bool"
description: """
Disables JSON format for logging and enables more human-readable output with colors.
Disable for production.
"""
}
level: {
default: "\"warn\""
description: """
Minimum logging level. If set to "warn",
Levels warn, error, dpanic panic and fatal will be logged.
Recommended value for production: warn
Possible values: debug, info, warn, error, dpanic, panic, fatal
"""
}
filter: {
description: """
Log filtering rules by level and name (log-level:log-namespace).
Please note that level (LOG_LEVEL) is applied before filter and it affects the final output!
Leave unset for production.
Example:
`warn+:* *:auth,workflow.*`
Log warnings, errors, panic, fatals. Everything from auth and workflow is logged.
See more examples and documentation here: https://github.com/moul/zapfilter
"""
}
include_caller: {
type: "bool"
default: "false"
description: """
Set to true to see where the logging was called from.
Disable for production.
"""
}
stacktrace_level: {
default: "\"dpanic\""
description: """
Include stack-trace when logging at a specified level or below.
Disable for production.
Possible values: debug, info, warn, error, dpanic, panic, fatal
"""
}
}
}

View File

@@ -0,0 +1,22 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
messagebus: schema.#optionsGroup & {
handle: "messagebus"
options: {
Enabled: {
type: "bool"
default: "true"
description: "Enable messagebus"
}
log_enabled: {
type: "bool"
default: "false"
description: "Enable extra logging for messagebus watchers"
}
}
title: "Messaging queue"
}

22
app/options/monitor.cue Normal file
View File

@@ -0,0 +1,22 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
monitor: schema.#optionsGroup & {
handle: "monitor"
imports: [
"\"time\"",
]
options: {
interval: {
type: "time.Duration"
default: "300 * time.Second"
description: "Output (log) interval for monitoring."
}
}
title: "Monitoring"
}

View File

@@ -0,0 +1,49 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
objectStore: schema.#optionsGroup & {
handle: "ObjectStore"
title: "Object (file) storage"
intro: "The MinIO integration allows you to replace local storage with cloud storage. When configured, `STORAGE_PATH` is not needed."
options: {
path: {
default: "\"var/store\""
description: "Location where uploaded files are stored."
env: "STORAGE_PATH"
}
minioEndpoint: {
env: "MINIO_ENDPOINT"
}
minioSecure: {
type: "bool"
default: "true"
env: "MINIO_SECURE"
}
minioAccessKey: {
env: "MINIO_ACCESS_KEY"
}
minioSecretKey: {
env: "MINIO_SECRET_KEY"
}
minioSSECKey: {
env: "MINIO_SSEC_KEY"
}
minioBucket: {
default: "\"{component}\""
description: "`component` placeholder is replaced with service name (e.g system)."
env: "MINIO_BUCKET"
}
minioPathPrefix: {
description: "`component` placeholder is replaced with service name (e.g system)."
env: "MINIO_PATH_PREFIX"
}
minioStrict: {
type: "bool"
default: "false"
env: "MINIO_STRICT"
}
}
}

20
app/options/plugins.cue Normal file
View File

@@ -0,0 +1,20 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
plugins: schema.#optionsGroup & {
handle: "plugins"
options: {
Enabled: {
type: "bool"
default: "true"
description: "Enable plugins"
}
Paths: {
description: "List of colon seperated paths or patterns where plugins could be found"
}
}
title: "Plugins"
}

32
app/options/provision.cue Normal file
View File

@@ -0,0 +1,32 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
provision: schema.#optionsGroup & {
handle: "provision"
options: {
always: {
type: "bool"
default: "true"
description: "Controls if provision should run when the server starts."
}
path: {
default: "\"provision/*\""
description: "Colon seperated paths to config files for provisioning."
}
}
title: "Provisioning"
intro: """
Provisioning allows you to configure a {PRODUCT_NAME} instance when deployed.
It occurs automatically after the {PRODUCT_NAME} server starts.
[IMPORTANT]
====
We recommend you to keep provisioning enabled as it simplifies version updates by updating the database and updating settings.
If you're doing local development or some debugging, you can disable this.
====
"""
}

16
app/options/seeder.cue Normal file
View File

@@ -0,0 +1,16 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
seeder: schema.#optionsGroup & {
handle: "seeder"
options: {
log_enabled: {
type: "bool"
description: "Enable extra logging // fixme add some more description"
}
}
title: "Seeder"
}

62
app/options/sentry.cue Normal file
View File

@@ -0,0 +1,62 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
sentry: schema.#optionsGroup & {
handle: "sentry"
imports: [
"\"github.com/cortezaproject/corteza-server/pkg/version\""
]
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.
====
"""
options: {
DSN: {
description: "Set to enable Sentry client."
}
debug: {
type: "bool"
description: "Print out debugging information."
}
attach_stacktrace: {
type: "bool"
default: "true"
description: "Attach stacktraces"
}
sample_rate: {
type: "float64"
description: "Sample rate for event submission (0.0 - 1.0. defaults to 1.0)"
}
max_breadcrumbs: {
type: "int"
default: "0"
description: "Maximum number of bredcrumbs."
}
server_name: {
description: "Set reported Server name."
env: "SENTRY_SERVERNAME"
}
release: {
default: "version.Version"
description: "Set reported Release."
}
dist: {
description: "Set reported distribution."
}
environment: {
description: "Set reported environment."
}
}
}

23
app/options/template.cue Normal file
View File

@@ -0,0 +1,23 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
template: schema.#optionsGroup & {
handle: "template"
title: "Rendering engine"
options: {
renderer_gotenberg_address: {
default: ""
description: "Gotenberg rendering container address."
}
renderer_gotenberg_enabled: {
type: "bool"
default: "false"
description: "Is Gotenberg rendering container enabled."
}
}
}

26
app/options/upgrade.cue Normal file
View File

@@ -0,0 +1,26 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
upgrade: schema.#optionsGroup & {
handle: "upgrade"
title: "Data store (database) upgrade"
options: {
debug: {
type: "bool"
default: "false"
description: """
Enable/disable debug logging.
To enable debug logging set `UPGRADE_DEBUG=true`.
"""
}
always: {
type: "bool"
default: "true"
description: "Controls if the upgradable systems should be upgraded when the server starts."
}
}
}

74
app/options/waitFor.cue Normal file
View File

@@ -0,0 +1,74 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
waitFor: schema.#optionsGroup & {
handle: "waitFor"
imports: [
"\"time\"",
]
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.
====
"""
options: {
delay: {
type: "time.Duration"
default: "0"
description: """
Delays API startup for the amount of time specified (10s, 2m...).
This delay happens before service (`WAIT_FOR_SERVICES`) probing.
"""
env: "WAIT_FOR"
}
status_page: {
type: "bool"
default: "true"
description: "Show temporary status web page."
env: "WAIT_FOR_STATUS_PAGE"
}
services: {
description: """
Space delimited list of hosts and/or URLs to probe.
Host format: `host` or `host:443` (port will default to 80).
[NOTE]
====
Services are probed in parallel.
====
"""
env: "WAIT_FOR_SERVICES"
}
services_timeout: {
type: "time.Duration"
default: "time.Minute"
description: "Max time for each service probe."
env: "WAIT_FOR_SERVICES_TIMEOUT"
}
services_probe_timeout: {
type: "time.Duration"
default: "time.Second * 30"
description: "Timeout for each service probe."
env: "WAIT_FOR_SERVICES_PROBE_TIMEOUT"
}
services_probe_interval: {
type: "time.Duration"
default: "time.Second * 5"
description: "Interval between service probes."
env: "WAIT_FOR_SERVICES_PROBE_INTERVAL"
}
}
}

34
app/options/websocket.cue Normal file
View File

@@ -0,0 +1,34 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
websocket: schema.#optionsGroup & {
handle: "websocket"
imports: [
"\"time\"",
]
title: "Websocket server"
options: {
log_enabled: {
type: "bool"
description: "Enable extra logging for authentication flows"
}
timeout: {
type: "time.Duration"
default: "15 * time.Second"
description: "Time before `WsServer` gets timed out."
}
ping_timeout: {
type: "time.Duration"
default: "120 * time.Second"
}
ping_period: {
type: "time.Duration"
default: "((120 * time.Second) * 9) / 10"
}
}
}

27
app/options/workflow.cue Normal file
View File

@@ -0,0 +1,27 @@
package options
import (
"github.com/cortezaproject/corteza-server/codegen/schema"
)
workflow: schema.#optionsGroup & {
handle: "workflow"
options: {
register: {
type: "bool"
default: "true"
description: "Registers enabled and valid workflows and executes them when triggered"
}
exec_debug: {
type: "bool"
default: "false"
description: "Enables verbose logging for workflow execution"
}
call_stack_size: {
type: "int"
default: "16"
description: "Defines the maximum call stack size between workflows"
}
}
title: "Workflow"
}

View File

@@ -9,6 +9,10 @@ See [old codegen](../pkh/codegen/README.md).
Right now, Corteza is migrating its old YAML definitions to CUE.
We are also simplifying all templates by moving as much data manipulation to Cue as possible.
### Todo
- options documentation (see assets/templates/docs/options.gen.adoc.tpl)
## Intro
Codegen tools are based on [cuelang](https://cuelang.org/docs/tutorials/) and golang templates.
@@ -21,10 +25,10 @@ Codegen tools are based on [cuelang](https://cuelang.org/docs/tutorials/) and go
Platform, component and resource definitions (.cue files) can be found in:
- `app`
- `automation` @todo
- `automation`
- `system`
- `compose`
- `federation` @todo
- `federation`
## Running code generator
@@ -58,8 +62,7 @@ Collection of `#codegen` structs with template + payload + output instructions.
Main entry point that combines all components
- @todo options
- options (see [options.cue](./options.cue))
- @todo REST endpoints (unrelated to specific component)
#### Component

View File

@@ -0,0 +1,45 @@
package {{ .package }}
{{ template "gocode/header-gentext.tpl" }}
{{ if .imports }}
import (
{{- range .imports }}
{{ . }}
{{- end }}
)
{{- end }}
type (
{{ .struct }} struct {
{{- range .options }}
{{ .expIdent }} {{ .type }} `env:"{{ .env }}"`
{{- end }}
}
)
// {{ .func }} initializes and returns a {{ .struct }} with default values
//
// This function is auto-generated
func {{ .func }}() (o *{{ .struct }}) {
o = &{{ .struct }}{
{{- range .options }}
{{- if .default }}
{{ .expIdent }}: {{ .default }},
{{- end }}
{{- end }}
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *{{ .struct }}) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -0,0 +1,49 @@
package {{ .package }}
{{ template "gocode/header-gentext.tpl" }}
{{ if .imports }}
import (
{{- range .imports }}
{{ . }}
{{- end }}
)
{{- end }}
type (
{{ range .groups }}
{{ .struct }} struct {
{{- range .options }}
{{ .expIdent }} {{ .type }} `env:"{{ .env }}"`
{{- end }}
}
{{ end }}
)
{{ range .groups }}
// {{ .func }} initializes and returns a {{ .struct }} with default values
//
// This function is auto-generated
func {{ .func }}() (o *{{ .struct }}) {
o = &{{ .struct }}{
{{- range .options }}
{{- if .default }}
{{ .expIdent }}: {{ .default }},
{{- end }}
{{- end }}
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *{{ .struct }}) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
{{ end }}

42
codegen/options.cue Normal file
View File

@@ -0,0 +1,42 @@
package codegen
import (
"github.com/cortezaproject/corteza-server/app"
"github.com/cortezaproject/corteza-server/codegen/schema"
)
options:
[...schema.#codegen] &
[
// for g in app.corteza.options {
// template: "gocode/options/$options_group.go.tpl"
// output: "pkg/options/\(g.ident).gen.go"
// payload: {
// package: "options"
// imports: g.imports
// func: g.expIdent
// struct: g.expIdent + "Opt"
// options: g.options
// }
// },
{
template: "gocode/options/options.go.tpl"
output: "pkg/options/options.gen.go"
payload: {
package: "options"
// make unique list of packages we'll import
imports: [ for i in {for g in app.corteza.options for i in g.imports {"\(i)": i}} {i}]
groups: [
for g in app.corteza.options {
func: g.expIdent
struct: g.expIdent + "Opt"
options: g.options
}
]
}
},
]

View File

@@ -14,4 +14,5 @@ platform: [...schema.#codegen] &
rbacTypes+
localeTypes+
envoyRBAC+
options+
[] // placeholder

View File

@@ -0,0 +1,43 @@
package schema
import (
"strings"
)
#_ENV: =~ "^[A-Z][A-Z0-9_]*[A-Z0-9]?$"
//#_optName: =~ "^[a-zA-Z][a-zA-Z0-9\\s]*[a-zA-Z0-9]+$"
#optionsGroup: #_base & {
imports: [...string] | *([])
handle: #handle
title?: string
description?: string
env: #_ENV | *(strings.ToUpper(strings.Replace(handle, "-", "_", -1)))
_envPrefix: env
options: {
[_opt=_]: #option & {
handle: _opt
env: #_ENV | *(_envPrefix + "_" + strings.ToUpper(strings.Replace(handle, " ", "_", -1)))
}
}
}
#option: {
handle: #handle
_words: strings.Replace(strings.Replace(strings.Replace(handle, "-", " ", -1), "_", " ", -1), ".", " ", -1)
// lowercased (unexported, golang) identifier
ident: #ident | *strings.ToCamel(strings.Replace(strings.ToTitle(_words), " ", "", -1))
// upercased (exported, golang) identifier
expIdent: #expIdent | *strings.Replace(strings.ToTitle(_words), " ", "", -1)
type: string | *"string"
description?: string
default?: string
env?: #_ENV
}

View File

@@ -3,8 +3,8 @@ package schema
#platform: {
ident: #baseHandle | *"corteza"
options: [...#optionsGroup]
components: [...{platform: ident} & #component]
// env-var definitions
// options: {}

View File

@@ -16,6 +16,7 @@ import (
// More liberal then identifier, allows underscores and dots
#baseHandle: =~"^[a-z][a-z0-9-]*[a-z0-9]+$"
#_base: {
// lowercase dash-separated words
// used to build ident and exported identifiers

View File

@@ -1,48 +0,0 @@
package {{ .Package }}
// 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:
// {{ .Source }}
{{ if $.Imports -}}
import (
{{- range .Imports }}
{{ normalizeImport . }}
{{- end }}
){{ end }}
type (
{{ export $.Name }}Opt struct {
{{- range $prop := $.Properties}}
{{ export $prop.Name }} {{ $prop.Type }} `env:"{{ toUpper $prop.Env}}"`
{{- end }}
}
)
// {{ export $.Name }} initializes and returns a {{ export $.Name }}Opt with default values
func {{ export $.Name }}() (o *{{ export $.Name }}Opt) {
o = &{{ export $.Name }}Opt{
{{- range $prop := $.Properties }}
{{- if $prop.Default }}
{{ export $prop.Name }}: {{ $prop.Default }},
{{- end }}
{{- end }}
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *{{ export $.Name}}) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

18
pkg/codegen/codegen.go generated
View File

@@ -61,10 +61,6 @@ func Proc() {
storeSrc []string
storeDefs []*storeDef
optionSrcPath = filepath.Join("pkg", "options", "*.yaml")
optionSrc []string
optionDefs []*optionsDef
aFuncsSrcPath = filepath.Join("*", "automation", "*_handler.yaml")
aFuncsSrc []string
aFuncsDefs []*aFuncDefs
@@ -163,9 +159,6 @@ func Proc() {
storeSrc = glob(storeSrcPath)
output("loaded %d store definitions from %s\n", len(storeSrc), storeSrcPath)
optionSrc = glob(optionSrcPath)
output("loaded %d option definitions from %s\n", len(optionSrc), optionSrcPath)
aFuncsSrc = glob(aFuncsSrcPath)
output("loaded %d function definitions from %s\n", len(aFuncsSrc), aFuncsSrcPath)
@@ -184,7 +177,6 @@ func Proc() {
fileList = append(fileList, exprTypeSrc...)
fileList = append(fileList, restSrc...)
fileList = append(fileList, storeSrc...)
fileList = append(fileList, optionSrc...)
fileList = append(fileList, aFuncsSrc...)
for _, d := range fileList {
@@ -265,16 +257,6 @@ func Proc() {
return
}
if optionDefs, err = procOptions(optionSrc...); err == nil {
if genCode {
err = genOptions(tpls, optionDefs...)
}
if genDocs && err == nil {
err = genOptionsDocs(tpls, docPath+docGenBase, optionDefs...)
}
}
if outputErr(err, "fail to process options:\n") {
return
}

View File

@@ -1,151 +0,0 @@
package codegen
import (
"fmt"
"io"
"os"
"path"
"strings"
"text/template"
"gopkg.in/yaml.v3"
)
type (
optionsDef struct {
Source string
outputDir string
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"`
Properties optionsPropSet `yaml:"props"`
}
optionsPropSet []*optionsProp
optionsProp struct {
Name string
Type string
Env string
Default *optionsPropDefault
Description string
}
optionsPropDefault string
)
// Processes multiple options defenitions
func procOptions(mm ...string) (dd []*optionsDef, err error) {
var (
f io.ReadCloser
d *optionsDef
)
dd = make([]*optionsDef, 0)
for _, m := range mm {
err = func() error {
if f, err = os.Open(m); err != nil {
return err
}
defer f.Close()
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
}
for _, j := range d.Properties {
if j.Type == "" {
j.Type = "string"
}
if j.Env == "" {
j.Env = strings.ToUpper(d.Name + "_" + cc2underscore(j.Name))
}
}
d.Source = m
d.outputDir = path.Dir(m)
dd = append(dd, d)
return nil
}()
if err != nil {
return nil, fmt.Errorf("could not process %s: %w", m, err)
}
}
return dd, nil
}
// Custom UnmarshalYAML function for
func (pd *optionsPropDefault) UnmarshalYAML(n *yaml.Node) error {
val := n.Value
if n.Style == yaml.DoubleQuotedStyle {
val = "\"" + val + "\""
}
*pd = optionsPropDefault(val)
return nil
}
// Gets package name from file path
func (o optionsDef) Package() string {
return path.Base(path.Dir(o.Source))
}
func genOptions(tpl *template.Template, dd ...*optionsDef) (err error) {
var (
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, tplOptions, 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, "env-options.gen.adoc")
return plainTemplate(dst, tplOptionsAdoc, map[string]interface{}{
"Definitions": dd,
})
}

35
pkg/options/DB.gen.go generated
View File

@@ -1,35 +0,0 @@
package options
// 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
type (
DBOpt struct {
DSN string `env:"DB_DSN"`
}
)
// DB initializes and returns a DBOpt with default values
func DB() (o *DBOpt) {
o = &DBOpt{
DSN: "sqlite3://file::memory:?cache=shared&mode=memory",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *DB) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,7 +0,0 @@
docs:
title: Connection to data store backend
props:
- name: DSN
default: "sqlite3://file::memory:?cache=shared&mode=memory"
description: Database connection string.

View File

@@ -1,41 +0,0 @@
package options
// 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
import (
"time"
)
type (
HTTPClientOpt struct {
ClientTSLInsecure bool `env:"HTTP_CLIENT_TLS_INSECURE"`
HttpClientTimeout time.Duration `env:"HTTP_CLIENT_TIMEOUT"`
}
)
// HTTPClient initializes and returns a HTTPClientOpt with default values
func HTTPClient() (o *HTTPClientOpt) {
o = &HTTPClientOpt{
ClientTSLInsecure: false,
HttpClientTimeout: 30 * time.Second,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *HTTPClient) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -2,6 +2,6 @@ package options
func (o *HTTPClientOpt) Defaults() {
// just in case anyone used env var with the typo (before it was fixed)
o.ClientTSLInsecure = EnvBool("HTTP_CLIENT_TSL_INSECURE", o.ClientTSLInsecure)
o.TlsInsecure = EnvBool("HTTP_CLIENT_TSL_INSECURE", o.TlsInsecure)
}

View File

@@ -1,24 +0,0 @@
imports:
- time
docs:
title: HTTP Client
props:
- name: clientTSLInsecure
type: bool
env: HTTP_CLIENT_TLS_INSECURE
default: false
description: |-
Allow insecure (invalid, expired TLS/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
default: 30 * time.Second
description: Default timeout for clients.

View File

@@ -1,77 +0,0 @@
package options
// 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
import (
"github.com/cortezaproject/corteza-server/pkg/rand"
)
type (
HTTPServerOpt struct {
Addr string `env:"HTTP_ADDR"`
LogRequest bool `env:"HTTP_LOG_REQUEST"`
LogResponse bool `env:"HTTP_LOG_RESPONSE"`
Tracing bool `env:"HTTP_ERROR_TRACING"`
EnableHealthcheckRoute bool `env:"HTTP_ENABLE_HEALTHCHECK_ROUTE"`
EnableVersionRoute bool `env:"HTTP_ENABLE_VERSION_ROUTE"`
EnableDebugRoute bool `env:"HTTP_ENABLE_DEBUG_ROUTE"`
EnableMetrics bool `env:"HTTP_METRICS"`
MetricsServiceLabel string `env:"HTTP_METRICS_NAME"`
MetricsUsername string `env:"HTTP_METRICS_USERNAME"`
MetricsPassword string `env:"HTTP_METRICS_PASSWORD"`
EnablePanicReporting bool `env:"HTTP_REPORT_PANIC"`
BaseUrl string `env:"HTTP_BASE_URL"`
ApiEnabled bool `env:"HTTP_API_ENABLED"`
ApiBaseUrl string `env:"HTTP_API_BASE_URL"`
WebappEnabled bool `env:"HTTP_WEBAPP_ENABLED"`
WebappBaseUrl string `env:"HTTP_WEBAPP_BASE_URL"`
WebappBaseDir string `env:"HTTP_WEBAPP_BASE_DIR"`
WebappList string `env:"HTTP_WEBAPP_LIST"`
SslTerminated bool `env:"HTTP_SSL_TERMINATED"`
}
)
// HTTPServer initializes and returns a HTTPServerOpt with default values
func HTTPServer() (o *HTTPServerOpt) {
o = &HTTPServerOpt{
Addr: ":80",
LogRequest: false,
LogResponse: false,
Tracing: false,
EnableHealthcheckRoute: true,
EnableVersionRoute: true,
EnableDebugRoute: false,
EnableMetrics: false,
MetricsServiceLabel: "corteza",
MetricsUsername: "metrics",
MetricsPassword: string(rand.Bytes(5)),
EnablePanicReporting: true,
BaseUrl: "/",
ApiEnabled: true,
ApiBaseUrl: "/",
WebappEnabled: false,
WebappBaseUrl: "/",
WebappBaseDir: "./webapp/public",
WebappList: "admin,compose,workflow,reporter",
SslTerminated: isSecure(),
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *HTTPServer) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,119 +0,0 @@
imports:
- github.com/cortezaproject/corteza-server/pkg/rand
docs:
title: HTTP Server
props:
- name: addr
env: HTTP_ADDR
default: ":80"
description: IP and port for the HTTP server.
- name: logRequest
type: bool
env: HTTP_LOG_REQUEST
default: false
description: Log HTTP requests.
- name: logResponse
type: bool
env: HTTP_LOG_RESPONSE
default: false
description: Log HTTP responses.
- name: tracing
type: bool
env: HTTP_ERROR_TRACING
default: false
- name: enableHealthcheckRoute
type: bool
env: HTTP_ENABLE_HEALTHCHECK_ROUTE
default: true
- name: enableVersionRoute
type: bool
env: HTTP_ENABLE_VERSION_ROUTE
default: true
description: Enable `/version` route.
- name: enableDebugRoute
type: bool
env: HTTP_ENABLE_DEBUG_ROUTE
default: false
description: Enable `/debug` route.
- name: enableMetrics
type: bool
env: HTTP_METRICS
default: false
description: Enable (prometheus) metrics.
- name: metricsServiceLabel
env: HTTP_METRICS_NAME
default: "corteza"
description: Name for metrics endpoint.
- name: metricsUsername
env: HTTP_METRICS_USERNAME
default: "metrics"
description: Username for the metrics endpoint.
- name: metricsPassword
env: HTTP_METRICS_PASSWORD
default: string(rand.Bytes(5))
description: Password for the metrics endpoint.
- name: enablePanicReporting
type: bool
env: HTTP_REPORT_PANIC
default: true
description: Report HTTP panic to Sentry.
- name: baseUrl
env: HTTP_BASE_URL
default: "/"
description: |-
Base URL (prefix) for all routes (<baseUrl>/auth, <baseUrl>/api, ...)
- name: apiEnabled
type: bool
env: HTTP_API_ENABLED
default: true
- name: apiBaseUrl
env: HTTP_API_BASE_URL
default: "/"
description: |-
When webapps are enabled (HTTP_WEBAPP_ENABLED) this is moved to '/api' if not explicitly set otherwise.
API base URL is internaly prefixed with baseUrl
- name: webappEnabled
type: bool
env: HTTP_WEBAPP_ENABLED
default: false
- name: webappBaseUrl
env: HTTP_WEBAPP_BASE_URL
default: "/"
description: |-
Webapp base URL is internaly prefixed with baseUrl
- name: webappBaseDir
env: HTTP_WEBAPP_BASE_DIR
default: "./webapp/public"
- name: webappList
env: HTTP_WEBAPP_LIST
default: "admin,compose,workflow,reporter"
- name: sslTerminated
env: HTTP_SSL_TERMINATED
type: bool
default: isSecure()
description: |-
Is SSL termination enabled in ingres, proxy or load balancer that is in front of Corteza?
By default, Corteza checks for presence of LETSENCRYPT_HOST environmental variable.
This DOES NOT enable SSL termination in Cortreza!

View File

@@ -1,41 +0,0 @@
package options
// 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/RBAC.yaml
type (
RBACOpt struct {
Log bool `env:"RBAC_LOG"`
ServiceUser string `env:"RBAC_SERVICE_USER"`
BypassRoles string `env:"RBAC_BYPASS_ROLES"`
AuthenticatedRoles string `env:"RBAC_AUTHENTICATED_ROLES"`
AnonymousRoles string `env:"RBAC_ANONYMOUS_ROLES"`
}
)
// RBAC initializes and returns a RBACOpt with default values
func RBAC() (o *RBACOpt) {
o = &RBACOpt{
BypassRoles: "super-admin",
AuthenticatedRoles: "authenticated",
AnonymousRoles: "anonymous",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *RBAC) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,45 +0,0 @@
docs:
title: RBAC options
props:
# Maybe someday we'll allow RBAC to be disabled
#
# Boolean might not be the best way but providing a secret here that would
# protect the entire corteza with a simple basic HTTP out while RBAC check are disabled
# would make sense?
#
# - name: enabled
# type: bool
# default: true
# description: When disabled all operations on all resources are allowed
- name: log
type: bool
description: Log RBAC related events and actions
- name: serviceUser
- name: bypassRoles
# Using literal string instead of DefaultBypassRole constant for clarity & documentation
default: "super-admin"
description: |-
Space delimited list of role handles.
These roles causes short-circuiting access control check and allowing all operations.
System will refuse to start if check-bypassing roles are also listed as authenticated or anonymous auto-assigned roles.
- name: authenticatedRoles
# Using literal string instead of DefaultAuthenticatedRole constant for clarity & documentation
default: "authenticated"
description: |-
Space delimited list of role handles.
These roles are automatically assigned to authenticated user.
Memberships can not be managed for these roles.
System will refuse to start if roles listed here are also listed under anonymous roles
- name: anonymousRoles
# Using literal string instead of DefaultAnonymousRole constant for clarity & documentation
default: "anonymous"
description: |-
Space delimited list of role handles.
These roles are automatically assigned to anonymous user.
Memberships can not be managed for these roles.

View File

@@ -1,40 +0,0 @@
package options
// 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/SCIM.yaml
type (
SCIMOpt struct {
Enabled bool `env:"SCIM_ENABLED"`
BaseURL string `env:"SCIM_BASE_URL"`
Secret string `env:"SCIM_SECRET"`
ExternalIdAsPrimary bool `env:"SCIM_EXTERNAL_ID_AS_PRIMARY"`
ExternalIdValidation string `env:"SCIM_EXTERNAL_ID_VALIDATION"`
}
)
// SCIM initializes and returns a SCIMOpt with default values
func SCIM() (o *SCIMOpt) {
o = &SCIMOpt{
BaseURL: "/scim",
ExternalIdValidation: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SCIM) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,18 +0,0 @@
docs:
title: SCIM Server
props:
- name: enabled
type: bool
description: Enable SCIM subsystem
- name: baseURL
default: "/scim"
description: Prefix for SCIM API endpoints
- name: secret
description: Secret to use to validate requests on SCIM API endpoints
- name: externalIdAsPrimary
type: bool
description: Use external IDs in SCIM API endpoints
- name: externalIdValidation
default: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
description: Validates format of external IDs. Defaults to UUID

View File

@@ -1,43 +0,0 @@
package options
// 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
type (
SMTPOpt struct {
Host string `env:"SMTP_HOST"`
Port int `env:"SMTP_PORT"`
User string `env:"SMTP_USER"`
Pass string `env:"SMTP_PASS"`
From string `env:"SMTP_FROM"`
TlsInsecure bool `env:"SMTP_TLS_INSECURE"`
TlsServerName string `env:"SMTP_TLS_SERVER_NAME"`
}
)
// SMTP initializes and returns a SMTPOpt with default values
func SMTP() (o *SMTPOpt) {
o = &SMTPOpt{
Host: "localhost",
Port: 25,
TlsInsecure: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SMTP) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,35 +0,0 @@
docs:
title: Email sending
intro: |-
Configure your local SMTP server or use one of the available providers.
These values are copied to settings when the server starts and can be managed from the administration console.
We recommend you remove these values after they are copied to settings.
If server detects difference between these options and settings, it shows a warning in the log on server start.
props:
- name: host
default: "localhost"
description: |-
The SMTP server hostname.
- name: port
type: int
default: 25
description: The SMTP post.
- name: user
description: The SMTP username.
- name: pass
description: The SMTP password.
- name: from
description: The SMTP `from` email parameter
- name: tlsInsecure
type: bool
default: false
description: Allow insecure (invalid, expired TLS certificates) connections.
- name: tlsServerName

View File

@@ -1,39 +0,0 @@
package options
// 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
type (
ActionLogOpt struct {
Enabled bool `env:"ACTIONLOG_ENABLED"`
Debug bool `env:"ACTIONLOG_DEBUG"`
WorkflowFunctionsEnabled bool `env:"ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED"`
}
)
// ActionLog initializes and returns a ActionLogOpt with default values
func ActionLog() (o *ActionLogOpt) {
o = &ActionLogOpt{
Enabled: true,
Debug: false,
WorkflowFunctionsEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ActionLog) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,21 +0,0 @@
docs:
title: Actionlog
props:
- name: enabled
type: bool
default: true
docs:
description: Enable action logging.
- name: debug
type: bool
default: false
docs:
description: Enable debug action logging.
- name: workflowFunctionsEnabled
type: bool
default: false
docs:
description: Enable workflow function for searching and recording actions

View File

@@ -1,51 +0,0 @@
package options
// 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/apigw.yaml
import (
"time"
)
type (
ApigwOpt struct {
Enabled bool `env:"APIGW_ENABLED"`
Debug bool `env:"APIGW_DEBUG"`
LogEnabled bool `env:"APIGW_LOG_ENABLED"`
LogRequestBody bool `env:"APIGW_LOG_REQUEST_BODY"`
ProxyEnableDebugLog bool `env:"APIGW_PROXY_ENABLE_DEBUG_LOG"`
ProxyFollowRedirects bool `env:"APIGW_PROXY_FOLLOW_REDIRECTS"`
ProxyOutboundTimeout time.Duration `env:"APIGW_PROXY_OUTBOUND_TIMEOUT"`
}
)
// Apigw initializes and returns a ApigwOpt with default values
func Apigw() (o *ApigwOpt) {
o = &ApigwOpt{
Enabled: true,
Debug: false,
LogEnabled: false,
LogRequestBody: false,
ProxyEnableDebugLog: false,
ProxyFollowRedirects: true,
ProxyOutboundTimeout: time.Second * 30,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Apigw) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,49 +0,0 @@
docs:
title: API Gateway
imports:
- time
props:
- name: Enabled
type: bool
default: true
description: |-
Enable API Gateway
- name: Debug
type: bool
default: false
description: |-
Enable API Gateway debugging info
- name: logEnabled
type: bool
default: false
description: |-
Enable extra logging
- name: logRequestBody
type: bool
default: false
description: |-
Enable incoming request body output in logs
- name: proxyEnableDebugLog
type: bool
default: false
description: |-
Enable full debug log on requests / responses - warning, includes sensitive data
- name: proxyFollowRedirects
type: bool
default: true
description: |-
Follow redirects on proxy requests
- name: proxyOutboundTimeout
type: time.Duration
default: time.Second * 30
description: |-
Outbound request timeout

View File

@@ -1,85 +0,0 @@
package options
// 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
import (
"time"
)
type (
AuthOpt struct {
LogEnabled bool `env:"AUTH_LOG_ENABLED"`
PasswordSecurity bool `env:"AUTH_PASSWORD_SECURITY"`
Secret string `env:"AUTH_JWT_SECRET"`
AccessTokenLifetime time.Duration `env:"AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME"`
RefreshTokenLifetime time.Duration `env:"AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME"`
Expiry time.Duration `env:"AUTH_JWT_EXPIRY"`
ExternalRedirectURL string `env:"AUTH_EXTERNAL_REDIRECT_URL"`
ExternalCookieSecret string `env:"AUTH_EXTERNAL_COOKIE_SECRET"`
BaseURL string `env:"AUTH_BASE_URL"`
SessionCookieName string `env:"AUTH_SESSION_COOKIE_NAME"`
SessionCookiePath string `env:"AUTH_SESSION_COOKIE_PATH"`
SessionCookieDomain string `env:"AUTH_SESSION_COOKIE_DOMAIN"`
SessionCookieSecure bool `env:"AUTH_SESSION_COOKIE_SECURE"`
SessionLifetime time.Duration `env:"AUTH_SESSION_LIFETIME"`
SessionPermLifetime time.Duration `env:"AUTH_SESSION_PERM_LIFETIME"`
GarbageCollectorInterval time.Duration `env:"AUTH_GARBAGE_COLLECTOR_INTERVAL"`
RequestRateLimit int `env:"AUTH_REQUEST_RATE_LIMIT"`
RequestRateWindowLength time.Duration `env:"AUTH_REQUEST_RATE_WINDOW_LENGTH"`
CsrfSecret string `env:"AUTH_CSRF_SECRET"`
CsrfEnabled bool `env:"AUTH_CSRF_ENABLED"`
CsrfFieldName string `env:"AUTH_CSRF_FIELD_NAME"`
CsrfCookieName string `env:"AUTH_CSRF_COOKIE_NAME"`
DefaultClient string `env:"AUTH_DEFAULT_CLIENT"`
AssetsPath string `env:"AUTH_ASSETS_PATH"`
DevelopmentMode bool `env:"AUTH_DEVELOPMENT_MODE"`
}
)
// Auth initializes and returns a AuthOpt with default values
func Auth() (o *AuthOpt) {
o = &AuthOpt{
PasswordSecurity: true,
Secret: getSecretFromEnv("jwt secret"),
AccessTokenLifetime: time.Hour * 2,
RefreshTokenLifetime: time.Hour * 24 * 3,
Expiry: time.Hour * 24 * 30,
ExternalRedirectURL: fullURL("/auth/external/{provider}/callback"),
ExternalCookieSecret: getSecretFromEnv("external cookie secret"),
BaseURL: fullURL("/auth"),
SessionCookieName: "session",
SessionCookiePath: pathPrefix("/auth"),
SessionCookieDomain: guessHostname(),
SessionCookieSecure: isSecure(),
SessionLifetime: 24 * time.Hour,
SessionPermLifetime: 360 * 24 * time.Hour,
GarbageCollectorInterval: 15 * time.Minute,
RequestRateLimit: 60,
RequestRateWindowLength: time.Minute,
CsrfSecret: getSecretFromEnv("csrf secret"),
CsrfEnabled: true,
CsrfFieldName: "same-site-authenticity-token",
CsrfCookieName: "same-site-authenticity-token",
DefaultClient: "corteza-webapp",
AssetsPath: "",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Auth) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,182 +0,0 @@
imports:
- time
docs:
title: Authentication
props:
- name: logEnabled
type: bool
description: |-
Enable extra logging for authentication flows
- name: passwordSecurity
type: bool
default: true
description: |-
Password security allows you to disable constraints to which passwords must conform to.
[CAUTION]
====
Disabling password security can be useful for development environments as it removes the need for complex passwords.
Password security *should be enabled* on production environments to avoid security incidents
====
- name: secret
env: AUTH_JWT_SECRET
default: getSecretFromEnv("jwt secret")
description: |-
Secret used for signing JWT tokens.
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
- name: accessTokenLifetime
type: time.Duration
env: AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME
default: time.Hour * 2
description: Access token lifetime
- name: refreshTokenLifetime
type: time.Duration
env: AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME
default: time.Hour * 24 * 3
description: Refresh token lifetime
- name: expiry
type: time.Duration
env: AUTH_JWT_EXPIRY
default: time.Hour * 24 * 30
description: Experation time for the auth JWT tokens.
- name: externalRedirectURL
default: fullURL("/auth/external/{provider}/callback")
description: |-
Redirect URL to be sent with OAuth2 authentication request to provider
`provider` placeholder is replaced with the actual value when used.
- name: externalCookieSecret
default: getSecretFromEnv("external cookie secret")
description: |-
Secret used for securing cookies
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
- name: baseURL
default: fullURL("/auth")
description: |-
Frontend base URL. Must be an absolute URL, with the domain.
This is used for some redirects and links in auth emails.
- name: sessionCookieName
default: "session"
description: |-
Session cookie name
- name: sessionCookiePath
default: pathPrefix("/auth")
description: |-
Session cookie path
- name: sessionCookieDomain
default: guessHostname()
description: |-
Session cookie domain
- name: sessionCookieSecure
type: bool
default: isSecure()
description: |-
Defaults to true when HTTPS is used. Corteza will try to guess the this setting by
- name: sessionLifetime
type: time.Duration
default: 24 * time.Hour
description: |-
How long do we keep the temporary session
- name: sessionPermLifetime
type: time.Duration
default: 360 * 24 * time.Hour
description: |-
How long do we keep the permanent session
- name: garbageCollectorInterval
type: time.Duration
default: 15 * time.Minute
description: |-
How often are expired sessions and tokens purged from the database
- name: requestRateLimit
type: int
default: 60
description: |-
How many requests from a cerain IP address are allowed in a time window.
Set to zero to disable
- name: requestRateWindowLength
type: time.Duration
default: time.Minute
description: |-
How many requests from a cerain IP address are allowed in a time window
- name: csrfSecret
default: getSecretFromEnv("csrf secret")
description: |-
Secret used for securing CSRF protection
[IMPORTANT]
====
If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables.
Generated secret will change if you change any of these variables.
====
- name: csrfEnabled
type: bool
default: true
description: |-
Enable CSRF protection
- name: csrfFieldName
default: "same-site-authenticity-token"
description: |-
Form field name used for CSRF protection
- name: csrfCookieName
default: "same-site-authenticity-token"
description: |-
Cookie name used for CSRF protection
- name: defaultClient
default: "corteza-webapp"
description: |
Handle for OAuth2 client used for automatic redirect from /auth/oauth2/go endpoint.
This simplifies configuration for OAuth2 flow for Corteza Web applications as it removes
the need to suply redirection URL and client ID (oauth2/go endpoint does that internally)
- name: assetsPath
default: ""
description: |-
Path to js, css, images and template source files
When corteza starts, if path exists it tries to load template files from it.
If not it uses statically embedded files.
When empty path is set (default value), embedded files are used.
- name: developmentMode
type: bool
description: |-
When enabled, corteza reloads template before every execution.
Enable this for debugging or when developing auth templates.
Should be disabled in production where templates do not change between server restarts.

View File

@@ -1,64 +0,0 @@
package options
// 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
import (
"time"
)
type (
CorredorOpt struct {
Enabled bool `env:"CORREDOR_ENABLED"`
Addr string `env:"CORREDOR_ADDR"`
MaxBackoffDelay time.Duration `env:"CORREDOR_MAX_BACKOFF_DELAY"`
MaxReceiveMessageSize int `env:"CORREDOR_MAX_RECEIVE_MESSAGE_SIZE"`
DefaultExecTimeout time.Duration `env:"CORREDOR_DEFAULT_EXEC_TIMEOUT"`
ListTimeout time.Duration `env:"CORREDOR_LIST_TIMEOUT"`
ListRefresh time.Duration `env:"CORREDOR_LIST_REFRESH"`
RunAsEnabled bool `env:"CORREDOR_RUN_AS_ENABLED"`
TlsCertEnabled bool `env:"CORREDOR_CLIENT_CERTIFICATES_ENABLED"`
TlsCertPath string `env:"CORREDOR_CLIENT_CERTIFICATES_PATH"`
TlsCertCA string `env:"CORREDOR_CLIENT_CERTIFICATES_CA"`
TlsCertPrivate string `env:"CORREDOR_CLIENT_CERTIFICATES_PRIVATE"`
TlsCertPublic string `env:"CORREDOR_CLIENT_CERTIFICATES_PUBLIC"`
TlsServerName string `env:"CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME"`
}
)
// Corredor initializes and returns a CorredorOpt with default values
func Corredor() (o *CorredorOpt) {
o = &CorredorOpt{
Enabled: false,
Addr: "localhost:50051",
MaxBackoffDelay: time.Minute,
MaxReceiveMessageSize: 2 << 23,
DefaultExecTimeout: time.Minute,
ListTimeout: time.Second * 2,
ListRefresh: time.Second * 5,
RunAsEnabled: true,
TlsCertEnabled: false,
TlsCertPath: "/certs/corredor/client",
TlsCertCA: "ca.crt",
TlsCertPrivate: "private.key",
TlsCertPublic: "public.crt",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Corredor) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,65 +0,0 @@
imports:
- "time"
docs:
title: Connection to Corredor
props:
- name: enabled
type: bool
default: false
description: Enable/disable Corredor integration
- name: addr
default: "localhost:50051"
description: Hostname and port of the Corredor gRPC server.
- name: maxBackoffDelay
type: time.Duration
default: time.Minute
description: Max delay for backoff on connection.
- name: maxReceiveMessageSize
type: int
default: 2 << 23
description: Max message size that can be recived.
- name: defaultExecTimeout
type: time.Duration
default: time.Minute
- name: listTimeout
type: time.Duration
default: time.Second * 2
- name: listRefresh
type: time.Duration
default: time.Second * 5
- name: runAsEnabled
type: bool
default: true
- name: tlsCertEnabled
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

View File

@@ -1,35 +0,0 @@
package options
// 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
type (
EnvironmentOpt struct {
Environment string `env:"ENVIRONMENT"`
}
)
// Environment initializes and returns a EnvironmentOpt with default values
func Environment() (o *EnvironmentOpt) {
o = &EnvironmentOpt{
Environment: "production",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Environment) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,7 +0,0 @@
docs:
title: Environment
props:
- name: environment
default: "production"
env: ENVIRONMENT

View File

@@ -1,41 +0,0 @@
package options
// 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
import (
"time"
)
type (
EventbusOpt struct {
SchedulerEnabled bool `env:"EVENTBUS_SCHEDULER_ENABLED"`
SchedulerInterval time.Duration `env:"EVENTBUS_SCHEDULER_INTERVAL"`
}
)
// Eventbus initializes and returns a EventbusOpt with default values
func Eventbus() (o *EventbusOpt) {
o = &EventbusOpt{
SchedulerEnabled: true,
SchedulerInterval: time.Minute,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Eventbus) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,16 +0,0 @@
imports:
- time
docs:
title: Events and scheduler
props:
- name: schedulerEnabled
type: bool
default: true
description: Enable eventbus sheduler.
- name: schedulerInterval
type: time.Duration
default: time.Minute
description: Set time interval for `eventbus` scheduler.

View File

@@ -1,51 +0,0 @@
package options
// 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/federation.yaml
import (
"time"
)
type (
FederationOpt struct {
Enabled bool `env:"FEDERATION_ENABLED"`
Label string `env:"FEDERATION_LABEL"`
Host string `env:"FEDERATION_HOST"`
StructureMonitorInterval time.Duration `env:"FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL"`
StructurePageSize int `env:"FEDERATION_SYNC_STRUCTURE_PAGE_SIZE"`
DataMonitorInterval time.Duration `env:"FEDERATION_SYNC_DATA_MONITOR_INTERVAL"`
DataPageSize int `env:"FEDERATION_SYNC_DATA_PAGE_SIZE"`
}
)
// Federation initializes and returns a FederationOpt with default values
func Federation() (o *FederationOpt) {
o = &FederationOpt{
Enabled: false,
Label: "Federation label",
Host: "local.cortezaproject.org",
StructureMonitorInterval: time.Minute * 2,
StructurePageSize: 1,
DataMonitorInterval: time.Second * 60,
DataPageSize: 100,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Federation) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,45 +0,0 @@
imports:
- time
props:
- name: Enabled
type: bool
default: false
env: FEDERATION_ENABLED
description: Federation enabled on system, it toggles rest API endpoints, possibility to map modules in Compose and sync itself
- name: Label
type: string
default: "Federation label"
env: FEDERATION_LABEL
description: Federation label
- name: Host
type: string
default: "local.cortezaproject.org"
env: FEDERATION_HOST
description: Host that is used during node pairing, also included in invitation
- name: StructureMonitorInterval
type: time.Duration
default: time.Minute * 2
env: FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL
description: Delay in seconds for structure sync
- name: StructurePageSize
type: int
default: 1
env: FEDERATION_SYNC_STRUCTURE_PAGE_SIZE
description: Bulk size in fetching for structure sync
- name: DataMonitorInterval
type: time.Duration
default: time.Second * 60
env: FEDERATION_SYNC_DATA_MONITOR_INTERVAL
description: Delay in seconds for data sync
- name: DataPageSize
type: int
default: 100
env: FEDERATION_SYNC_DATA_PAGE_SIZE
description: Bulk size in fetching for data sync

View File

@@ -1,33 +0,0 @@
package options
// 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/limit.yaml
type (
LimitOpt struct {
SystemUsers int `env:"LIMIT_SYSTEM_USERS"`
}
)
// Limit initializes and returns a LimitOpt with default values
func Limit() (o *LimitOpt) {
o = &LimitOpt{}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Limit) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,50 +0,0 @@
docs:
title: Limits
props:
- name: systemUsers
type: int
description: |-
Maximum number of valid (not deleted, not suspended) users
# @todo to be implemented
# - name: systemRoles
# type: int
# description: |-
# Maximum number of valid (not deleted, not archived) roles
#
# @todo to be implemented
# - name: systemGatewayRouts
# type: int
# description: |-
# Maximum number of valid (not deleted) gateway routes
#
# @todo to be implemented
# - name: systemTemplates
# type: int
# description: |-
# Maximum number of valid (not deleted) templates
#
# @todo to be implemented
# - name: composeNamespaces
# type: int
# description: |-
# Maximum number of valid (not deleted) compose namespaces
#
# @todo to be implemented
# - name: composeModules
# type: int
# description: |-
# Maximum number of valid (not deleted) compose modules accross all namespaces
#
# @todo to be implemented
# - name: composeRecords
# type: int
# description: |-
# Maximum number of valid (not deleted) compose records accross all namespaces and modules
#
# @todo to be implemented
# - name: automationWorkflows
# type: int
# description: |-
# Maximum number of valid (not deleted) automation workflows

View File

@@ -1,41 +0,0 @@
package options
// 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/locale.yaml
type (
LocaleOpt struct {
Languages string `env:"LOCALE_LANGUAGES"`
Path string `env:"LOCALE_PATH"`
QueryStringParam string `env:"LOCALE_QUERY_STRING_PARAM"`
ResourceTranslationsEnabled bool `env:"LOCALE_RESOURCE_TRANSLATIONS_ENABLED"`
Log bool `env:"LOCALE_LOG"`
DevelopmentMode bool `env:"LOCALE_DEVELOPMENT_MODE"`
}
)
// Locale initializes and returns a LocaleOpt with default values
func Locale() (o *LocaleOpt) {
o = &LocaleOpt{
Languages: "en",
QueryStringParam: "lng",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Locale) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,33 +0,0 @@
props:
- name: languages
default: "en"
description: |
List of compa delimited languages (language tags) to enable.
In case when an enabled language can not be loaded, error is logged.
When loading language configurations (config.xml) from the configured path(s).
- name: path
description: One or more paths to locale config and translation files, separated by colon
- name: queryStringParam
description: |
Name of the query string parameter used to pass the language tag (it overrides Accept-Language header).
Set it to empty string to disable detection from the query string.
This parameter is ignored if only one language is enabled
default: "lng"
- name: resourceTranslationsEnabled
type: bool
description: |-
When enabled, Corteza all
- name: log
type: bool
description: Log locale related events and actions
- name: developmentMode
type: bool
description: |-
When enabled, Corteza reloads language files on every request
Enable this for debugging or developing.

41
pkg/options/log.gen.go generated
View File

@@ -1,41 +0,0 @@
package options
// 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/log.yaml
type (
LogOpt struct {
Debug bool `env:"LOG_DEBUG"`
Level string `env:"LOG_LEVEL"`
Filter string `env:"LOG_FILTER"`
IncludeCaller bool `env:"LOG_INCLUDE_CALLER"`
StacktraceLevel string `env:"LOG_STACKTRACE_LEVEL"`
}
)
// Log initializes and returns a LogOpt with default values
func Log() (o *LogOpt) {
o = &LogOpt{
Level: "warn",
IncludeCaller: false,
StacktraceLevel: "dpanic",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Log) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,49 +0,0 @@
props:
- name: debug
type: bool
description: |
Disables JSON format for logging and enables more human-readable output with colors.
Disable for production.
- name: level
default: "warn"
description: |
Minimum logging level. If set to "warn",
Levels warn, error, dpanic panic and fatal will be logged.
Recommended value for production: warn
Possible values: debug, info, warn, error, dpanic, panic, fatal
- name: filter
description: |
Log filtering rules by level and name (log-level:log-namespace).
Please note that level (LOG_LEVEL) is applied before filter and it affects the final output!
Leave unset for production.
Example:
`warn+:* *:auth,workflow.*`
Log warnings, errors, panic, fatals. Everything from auth and workflow is logged.
See more examples and documentation here: https://github.com/moul/zapfilter
- name: includeCaller
type: bool
default: false
description: |
Set to true to see where the logging was called from.
Disable for production.
- name: stacktraceLevel
default: "dpanic"
description: |
Include stack-trace when logging at a specified level or below.
Disable for production.
Possible values: debug, info, warn, error, dpanic, panic, fatal

View File

@@ -1,37 +0,0 @@
package options
// 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/messagebus.yaml
type (
MessagebusOpt struct {
Enabled bool `env:"MESSAGEBUS_ENABLED"`
LogEnabled bool `env:"MESSAGEBUS_LOG_ENABLED"`
}
)
// Messagebus initializes and returns a MessagebusOpt with default values
func Messagebus() (o *MessagebusOpt) {
o = &MessagebusOpt{
Enabled: true,
LogEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Messagebus) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,15 +0,0 @@
docs:
title: Messaging queue
props:
- name: Enabled
type: bool
default: true
description: |-
Enable messagebus
- name: logEnabled
type: bool
default: false
description: |-
Enable extra logging for messagebus watchers

View File

@@ -1,39 +0,0 @@
package options
// 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
import (
"time"
)
type (
MonitorOpt struct {
Interval time.Duration `env:"MONITOR_INTERVAL"`
}
)
// Monitor initializes and returns a MonitorOpt with default values
func Monitor() (o *MonitorOpt) {
o = &MonitorOpt{
Interval: 300 * time.Second,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Monitor) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,11 +0,0 @@
imports:
- time
docs:
title: Monitoring
props:
- name: interval
type: time.Duration
default: 300 * time.Second
description: Output (log) interval for monitoring.

View File

@@ -1,46 +0,0 @@
package options
// 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
type (
ObjectStoreOpt struct {
Path string `env:"STORAGE_PATH"`
MinioEndpoint string `env:"MINIO_ENDPOINT"`
MinioSecure bool `env:"MINIO_SECURE"`
MinioAccessKey string `env:"MINIO_ACCESS_KEY"`
MinioSecretKey string `env:"MINIO_SECRET_KEY"`
MinioSSECKey string `env:"MINIO_SSEC_KEY"`
MinioBucket string `env:"MINIO_BUCKET"`
MinioPathPrefix string `env:"MINIO_PATH_PREFIX"`
MinioStrict bool `env:"MINIO_STRICT"`
}
)
// ObjectStore initializes and returns a ObjectStoreOpt with default values
func ObjectStore() (o *ObjectStoreOpt) {
o = &ObjectStoreOpt{
Path: "var/store",
MinioSecure: true,
MinioBucket: "{component}",
MinioStrict: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ObjectStore) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,44 +0,0 @@
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
env: MINIO_ENDPOINT
- name: minioSecure
type: bool
env: MINIO_SECURE
default: true
- name: minioAccessKey
env: MINIO_ACCESS_KEY
- name: minioSecretKey
env: MINIO_SECRET_KEY
- name: minioSSECKey
env: MINIO_SSEC_KEY
- name: minioBucket
env: MINIO_BUCKET
default: "{component}"
description: |-
`component` placeholder is replaced with service name (e.g system).
- name: minioPathPrefix
env: MINIO_PATH_PREFIX
description: |-
`component` placeholder is replaced with service name (e.g system).
- name: minioStrict
type: bool
env: MINIO_STRICT
default: false

957
pkg/options/options.gen.go generated Normal file
View File

@@ -0,0 +1,957 @@
package options
// This file is auto-generated.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
import (
"github.com/cortezaproject/corteza-server/pkg/rand"
"github.com/cortezaproject/corteza-server/pkg/version"
"time"
)
type (
DBOpt struct {
DSN string `env:"DB_DSN"`
}
HTTPClientOpt struct {
Timeout time.Duration `env:"HTTP_CLIENT_TIMEOUT"`
TlsInsecure bool `env:"HTTP_CLIENT_TLS_INSECURE"`
}
HTTPServerOpt struct {
Addr string `env:"HTTP_ADDR"`
ApiBaseUrl string `env:"HTTP_API_BASE_URL"`
ApiEnabled bool `env:"HTTP_API_ENABLED"`
BaseUrl string `env:"HTTP_BASE_URL"`
EnableDebugRoute bool `env:"HTTP_ENABLE_DEBUG_ROUTE"`
EnableHealthcheckRoute bool `env:"HTTP_ENABLE_HEALTHCHECK_ROUTE"`
EnableMetrics bool `env:"HTTP_METRICS"`
EnablePanicReporting bool `env:"HTTP_REPORT_PANIC"`
EnableVersionRoute bool `env:"HTTP_ENABLE_VERSION_ROUTE"`
LogRequest bool `env:"HTTP_LOG_REQUEST"`
LogResponse bool `env:"HTTP_LOG_RESPONSE"`
MetricsPassword string `env:"HTTP_METRICS_PASSWORD"`
MetricsServiceLabel string `env:"HTTP_METRICS_NAME"`
MetricsUsername string `env:"HTTP_METRICS_USERNAME"`
SslTerminated bool `env:"HTTP_SSL_TERMINATED"`
Tracing bool `env:"HTTP_ERROR_TRACING"`
WebappBaseDir string `env:"HTTP_WEBAPP_BASE_DIR"`
WebappBaseUrl string `env:"HTTP_WEBAPP_BASE_URL"`
WebappEnabled bool `env:"HTTP_WEBAPP_ENABLED"`
WebappList string `env:"HTTP_WEBAPP_LIST"`
}
RBACOpt struct {
AnonymousRoles string `env:"RBAC_ANONYMOUS_ROLES"`
AuthenticatedRoles string `env:"RBAC_AUTHENTICATED_ROLES"`
BypassRoles string `env:"RBAC_BYPASS_ROLES"`
Log bool `env:"RBAC_LOG"`
ServiceUser string `env:"RBAC_SERVICE_USER"`
}
SCIMOpt struct {
BaseURL string `env:"SCIM_BASE_URL"`
Enabled bool `env:"SCIM_ENABLED"`
ExternalIdAsPrimary bool `env:"SCIM_EXTERNAL_ID_AS_PRIMARY"`
ExternalIdValidation string `env:"SCIM_EXTERNAL_ID_VALIDATION"`
Secret string `env:"SCIM_SECRET"`
}
SMTPOpt struct {
From string `env:"SMTP_FROM"`
Host string `env:"SMTP_HOST"`
Pass string `env:"SMTP_PASS"`
Port int `env:"SMTP_PORT"`
TlsInsecure bool `env:"SMTP_TLS_INSECURE"`
TlsServerName string `env:"SMTP_TLS_SERVER_NAME"`
User string `env:"SMTP_USER"`
}
ActionLogOpt struct {
Debug bool `env:"ACTIONLOG_DEBUG"`
Enabled bool `env:"ACTIONLOG_ENABLED"`
WorkflowFunctionsEnabled bool `env:"ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED"`
}
ApigwOpt struct {
Debug bool `env:"APIGW_DEBUG"`
Enabled bool `env:"APIGW_ENABLED"`
LogEnabled bool `env:"APIGW_LOG_ENABLED"`
LogRequestBody bool `env:"APIGW_LOG_REQUEST_BODY"`
ProxyEnableDebugLog bool `env:"APIGW_PROXY_ENABLE_DEBUG_LOG"`
ProxyFollowRedirects bool `env:"APIGW_PROXY_FOLLOW_REDIRECTS"`
ProxyOutboundTimeout time.Duration `env:"APIGW_PROXY_OUTBOUND_TIMEOUT"`
}
AuthOpt struct {
AccessTokenLifetime time.Duration `env:"AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME"`
AssetsPath string `env:"AUTH_ASSETS_PATH"`
BaseURL string `env:"AUTH_BASE_URL"`
CsrfCookieName string `env:"AUTH_CSRF_COOKIE_NAME"`
CsrfEnabled bool `env:"AUTH_CSRF_ENABLED"`
CsrfFieldName string `env:"AUTH_CSRF_FIELD_NAME"`
CsrfSecret string `env:"AUTH_CSRF_SECRET"`
DefaultClient string `env:"AUTH_DEFAULT_CLIENT"`
DevelopmentMode bool `env:"AUTH_DEVELOPMENT_MODE"`
Expiry time.Duration `env:"AUTH_JWT_EXPIRY"`
ExternalCookieSecret string `env:"AUTH_EXTERNAL_COOKIE_SECRET"`
ExternalRedirectURL string `env:"AUTH_EXTERNAL_REDIRECT_URL"`
GarbageCollectorInterval time.Duration `env:"AUTH_GARBAGE_COLLECTOR_INTERVAL"`
LogEnabled bool `env:"AUTH_LOG_ENABLED"`
PasswordSecurity bool `env:"AUTH_PASSWORD_SECURITY"`
RefreshTokenLifetime time.Duration `env:"AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME"`
RequestRateLimit int `env:"AUTH_REQUEST_RATE_LIMIT"`
RequestRateWindowLength time.Duration `env:"AUTH_REQUEST_RATE_WINDOW_LENGTH"`
Secret string `env:"AUTH_JWT_SECRET"`
SessionCookieDomain string `env:"AUTH_SESSION_COOKIE_DOMAIN"`
SessionCookieName string `env:"AUTH_SESSION_COOKIE_NAME"`
SessionCookiePath string `env:"AUTH_SESSION_COOKIE_PATH"`
SessionCookieSecure bool `env:"AUTH_SESSION_COOKIE_SECURE"`
SessionLifetime time.Duration `env:"AUTH_SESSION_LIFETIME"`
SessionPermLifetime time.Duration `env:"AUTH_SESSION_PERM_LIFETIME"`
}
CorredorOpt struct {
Addr string `env:"CORREDOR_ADDR"`
DefaultExecTimeout time.Duration `env:"CORREDOR_DEFAULT_EXEC_TIMEOUT"`
Enabled bool `env:"CORREDOR_ENABLED"`
ListRefresh time.Duration `env:"CORREDOR_LIST_REFRESH"`
ListTimeout time.Duration `env:"CORREDOR_LIST_TIMEOUT"`
MaxBackoffDelay time.Duration `env:"CORREDOR_MAX_BACKOFF_DELAY"`
MaxReceiveMessageSize int `env:"CORREDOR_MAX_RECEIVE_MESSAGE_SIZE"`
RunAsEnabled bool `env:"CORREDOR_RUN_AS_ENABLED"`
TlsCertCA string `env:"CORREDOR_CLIENT_CERTIFICATES_CA"`
TlsCertEnabled bool `env:"CORREDOR_CLIENT_CERTIFICATES_ENABLED"`
TlsCertPath string `env:"CORREDOR_CLIENT_CERTIFICATES_PATH"`
TlsCertPrivate string `env:"CORREDOR_CLIENT_CERTIFICATES_PRIVATE"`
TlsCertPublic string `env:"CORREDOR_CLIENT_CERTIFICATES_PUBLIC"`
TlsServerName string `env:"CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME"`
}
EnvironmentOpt struct {
Environment string `env:"ENVIRONMENT"`
}
EventbusOpt struct {
SchedulerEnabled bool `env:"EVENTBUS_SCHEDULER_ENABLED"`
SchedulerInterval time.Duration `env:"EVENTBUS_SCHEDULER_INTERVAL"`
}
FederationOpt struct {
DataMonitorInterval time.Duration `env:"FEDERATION_SYNC_DATA_MONITOR_INTERVAL"`
DataPageSize int `env:"FEDERATION_SYNC_DATA_PAGE_SIZE"`
Enabled bool `env:"FEDERATION_ENABLED"`
Host string `env:"FEDERATION_HOST"`
Label string `env:"FEDERATION_LABEL"`
StructureMonitorInterval time.Duration `env:"FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL"`
StructurePageSize int `env:"FEDERATION_SYNC_STRUCTURE_PAGE_SIZE"`
}
LimitOpt struct {
SystemUsers int `env:"LIMIT_SYSTEM_USERS"`
}
LocaleOpt struct {
DevelopmentMode bool `env:"LOCALE_DEVELOPMENT_MODE"`
Languages string `env:"LOCALE_LANGUAGES"`
Log bool `env:"LOCALE_LOG"`
Path string `env:"LOCALE_PATH"`
QueryStringParam string `env:"LOCALE_QUERY_STRING_PARAM"`
ResourceTranslationsEnabled bool `env:"LOCALE_RESOURCE_TRANSLATIONS_ENABLED"`
}
LogOpt struct {
Debug bool `env:"LOG_DEBUG"`
Filter string `env:"LOG_FILTER"`
IncludeCaller bool `env:"LOG_INCLUDE_CALLER"`
Level string `env:"LOG_LEVEL"`
StacktraceLevel string `env:"LOG_STACKTRACE_LEVEL"`
}
MessagebusOpt struct {
Enabled bool `env:"MESSAGEBUS_ENABLED"`
LogEnabled bool `env:"MESSAGEBUS_LOG_ENABLED"`
}
MonitorOpt struct {
Interval time.Duration `env:"MONITOR_INTERVAL"`
}
ObjectStoreOpt struct {
MinioAccessKey string `env:"MINIO_ACCESS_KEY"`
MinioBucket string `env:"MINIO_BUCKET"`
MinioEndpoint string `env:"MINIO_ENDPOINT"`
MinioPathPrefix string `env:"MINIO_PATH_PREFIX"`
MinioSSECKey string `env:"MINIO_SSEC_KEY"`
MinioSecretKey string `env:"MINIO_SECRET_KEY"`
MinioSecure bool `env:"MINIO_SECURE"`
MinioStrict bool `env:"MINIO_STRICT"`
Path string `env:"STORAGE_PATH"`
}
PluginsOpt struct {
Enabled bool `env:"PLUGINS_ENABLED"`
Paths string `env:"PLUGINS_PATHS"`
}
ProvisionOpt struct {
Always bool `env:"PROVISION_ALWAYS"`
Path string `env:"PROVISION_PATH"`
}
SeederOpt struct {
LogEnabled bool `env:"SEEDER_LOG_ENABLED"`
}
SentryOpt struct {
DSN string `env:"SENTRY_DSN"`
AttachStacktrace bool `env:"SENTRY_ATTACH_STACKTRACE"`
Debug bool `env:"SENTRY_DEBUG"`
Dist string `env:"SENTRY_DIST"`
Environment string `env:"SENTRY_ENVIRONMENT"`
MaxBreadcrumbs int `env:"SENTRY_MAX_BREADCRUMBS"`
Release string `env:"SENTRY_RELEASE"`
SampleRate float64 `env:"SENTRY_SAMPLE_RATE"`
ServerName string `env:"SENTRY_SERVERNAME"`
}
TemplateOpt struct {
RendererGotenbergAddress string `env:"TEMPLATE_RENDERER_GOTENBERG_ADDRESS"`
RendererGotenbergEnabled bool `env:"TEMPLATE_RENDERER_GOTENBERG_ENABLED"`
}
UpgradeOpt struct {
Always bool `env:"UPGRADE_ALWAYS"`
Debug bool `env:"UPGRADE_DEBUG"`
}
WaitForOpt struct {
Delay time.Duration `env:"WAIT_FOR"`
Services string `env:"WAIT_FOR_SERVICES"`
ServicesProbeInterval time.Duration `env:"WAIT_FOR_SERVICES_PROBE_INTERVAL"`
ServicesProbeTimeout time.Duration `env:"WAIT_FOR_SERVICES_PROBE_TIMEOUT"`
ServicesTimeout time.Duration `env:"WAIT_FOR_SERVICES_TIMEOUT"`
StatusPage bool `env:"WAIT_FOR_STATUS_PAGE"`
}
WebsocketOpt struct {
LogEnabled bool `env:"WEBSOCKET_LOG_ENABLED"`
PingPeriod time.Duration `env:"WEBSOCKET_PING_PERIOD"`
PingTimeout time.Duration `env:"WEBSOCKET_PING_TIMEOUT"`
Timeout time.Duration `env:"WEBSOCKET_TIMEOUT"`
}
WorkflowOpt struct {
CallStackSize int `env:"WORKFLOW_CALL_STACK_SIZE"`
ExecDebug bool `env:"WORKFLOW_EXEC_DEBUG"`
Register bool `env:"WORKFLOW_REGISTER"`
}
)
// DB initializes and returns a DBOpt with default values
//
// This function is auto-generated
func DB() (o *DBOpt) {
o = &DBOpt{
DSN: "sqlite3://file::memory:?cache=shared&mode=memory",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *DBOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// HTTPClient initializes and returns a HTTPClientOpt with default values
//
// This function is auto-generated
func HTTPClient() (o *HTTPClientOpt) {
o = &HTTPClientOpt{
Timeout: 30 * time.Second,
TlsInsecure: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *HTTPClientOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// HTTPServer initializes and returns a HTTPServerOpt with default values
//
// This function is auto-generated
func HTTPServer() (o *HTTPServerOpt) {
o = &HTTPServerOpt{
Addr: ":80",
ApiBaseUrl: "/",
ApiEnabled: true,
BaseUrl: "/",
EnableDebugRoute: false,
EnableHealthcheckRoute: true,
EnableMetrics: false,
EnablePanicReporting: true,
EnableVersionRoute: true,
LogRequest: false,
LogResponse: false,
MetricsPassword: string(rand.Bytes(5)),
MetricsServiceLabel: "corteza",
MetricsUsername: "metrics",
SslTerminated: isSecure(),
Tracing: false,
WebappBaseDir: "./webapp/public",
WebappBaseUrl: "/",
WebappEnabled: false,
WebappList: "admin,compose,workflow,reporter",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *HTTPServerOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// RBAC initializes and returns a RBACOpt with default values
//
// This function is auto-generated
func RBAC() (o *RBACOpt) {
o = &RBACOpt{
AnonymousRoles: "anonymous",
AuthenticatedRoles: "authenticated",
BypassRoles: "super-admin",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *RBACOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// SCIM initializes and returns a SCIMOpt with default values
//
// This function is auto-generated
func SCIM() (o *SCIMOpt) {
o = &SCIMOpt{
BaseURL: "/scim",
ExternalIdValidation: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SCIMOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// SMTP initializes and returns a SMTPOpt with default values
//
// This function is auto-generated
func SMTP() (o *SMTPOpt) {
o = &SMTPOpt{
Host: "localhost",
Port: 25,
TlsInsecure: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SMTPOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// ActionLog initializes and returns a ActionLogOpt with default values
//
// This function is auto-generated
func ActionLog() (o *ActionLogOpt) {
o = &ActionLogOpt{
Debug: false,
Enabled: true,
WorkflowFunctionsEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ActionLogOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Apigw initializes and returns a ApigwOpt with default values
//
// This function is auto-generated
func Apigw() (o *ApigwOpt) {
o = &ApigwOpt{
Debug: false,
Enabled: true,
LogEnabled: false,
LogRequestBody: false,
ProxyEnableDebugLog: false,
ProxyFollowRedirects: true,
ProxyOutboundTimeout: time.Second * 30,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ApigwOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Auth initializes and returns a AuthOpt with default values
//
// This function is auto-generated
func Auth() (o *AuthOpt) {
o = &AuthOpt{
AccessTokenLifetime: time.Hour * 2,
BaseURL: fullURL("/auth"),
CsrfCookieName: "same-site-authenticity-token",
CsrfEnabled: true,
CsrfFieldName: "same-site-authenticity-token",
CsrfSecret: getSecretFromEnv("csrf secret"),
DefaultClient: "corteza-webapp",
Expiry: time.Hour * 24 * 30,
ExternalCookieSecret: getSecretFromEnv("external cookie secret"),
ExternalRedirectURL: fullURL("/auth/external/{provider}/callback"),
GarbageCollectorInterval: 15 * time.Minute,
PasswordSecurity: true,
RefreshTokenLifetime: time.Hour * 24 * 3,
RequestRateLimit: 60,
RequestRateWindowLength: time.Minute,
Secret: getSecretFromEnv("jwt secret"),
SessionCookieDomain: guessHostname(),
SessionCookieName: "session",
SessionCookiePath: pathPrefix("/auth"),
SessionCookieSecure: isSecure(),
SessionLifetime: 24 * time.Hour,
SessionPermLifetime: 360 * 24 * time.Hour,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *AuthOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Corredor initializes and returns a CorredorOpt with default values
//
// This function is auto-generated
func Corredor() (o *CorredorOpt) {
o = &CorredorOpt{
Addr: "localhost:50051",
DefaultExecTimeout: time.Minute,
Enabled: false,
ListRefresh: time.Second * 5,
ListTimeout: time.Second * 2,
MaxBackoffDelay: time.Minute,
MaxReceiveMessageSize: 2 << 23,
RunAsEnabled: true,
TlsCertCA: "ca.crt",
TlsCertEnabled: false,
TlsCertPath: "/certs/corredor/client",
TlsCertPrivate: "private.key",
TlsCertPublic: "public.crt",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *CorredorOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Environment initializes and returns a EnvironmentOpt with default values
//
// This function is auto-generated
func Environment() (o *EnvironmentOpt) {
o = &EnvironmentOpt{
Environment: "production",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *EnvironmentOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Eventbus initializes and returns a EventbusOpt with default values
//
// This function is auto-generated
func Eventbus() (o *EventbusOpt) {
o = &EventbusOpt{
SchedulerEnabled: true,
SchedulerInterval: time.Minute,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *EventbusOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Federation initializes and returns a FederationOpt with default values
//
// This function is auto-generated
func Federation() (o *FederationOpt) {
o = &FederationOpt{
DataMonitorInterval: time.Second * 60,
DataPageSize: 100,
Enabled: false,
Host: "local.cortezaproject.org",
Label: "federated",
StructureMonitorInterval: time.Minute * 2,
StructurePageSize: 1,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *FederationOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Limit initializes and returns a LimitOpt with default values
//
// This function is auto-generated
func Limit() (o *LimitOpt) {
o = &LimitOpt{}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *LimitOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Locale initializes and returns a LocaleOpt with default values
//
// This function is auto-generated
func Locale() (o *LocaleOpt) {
o = &LocaleOpt{
Languages: "en",
QueryStringParam: "lng",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *LocaleOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Log initializes and returns a LogOpt with default values
//
// This function is auto-generated
func Log() (o *LogOpt) {
o = &LogOpt{
IncludeCaller: false,
Level: "warn",
StacktraceLevel: "dpanic",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *LogOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Messagebus initializes and returns a MessagebusOpt with default values
//
// This function is auto-generated
func Messagebus() (o *MessagebusOpt) {
o = &MessagebusOpt{
Enabled: true,
LogEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *MessagebusOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Monitor initializes and returns a MonitorOpt with default values
//
// This function is auto-generated
func Monitor() (o *MonitorOpt) {
o = &MonitorOpt{
Interval: 300 * time.Second,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *MonitorOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// ObjectStore initializes and returns a ObjectStoreOpt with default values
//
// This function is auto-generated
func ObjectStore() (o *ObjectStoreOpt) {
o = &ObjectStoreOpt{
MinioBucket: "{component}",
MinioSecure: true,
MinioStrict: false,
Path: "var/store",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ObjectStoreOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Plugins initializes and returns a PluginsOpt with default values
//
// This function is auto-generated
func Plugins() (o *PluginsOpt) {
o = &PluginsOpt{
Enabled: true,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *PluginsOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Provision initializes and returns a ProvisionOpt with default values
//
// This function is auto-generated
func Provision() (o *ProvisionOpt) {
o = &ProvisionOpt{
Always: true,
Path: "provision/*",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *ProvisionOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Seeder initializes and returns a SeederOpt with default values
//
// This function is auto-generated
func Seeder() (o *SeederOpt) {
o = &SeederOpt{}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SeederOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Sentry initializes and returns a SentryOpt with default values
//
// This function is auto-generated
func Sentry() (o *SentryOpt) {
o = &SentryOpt{
AttachStacktrace: true,
MaxBreadcrumbs: 0,
Release: version.Version,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *SentryOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Template initializes and returns a TemplateOpt with default values
//
// This function is auto-generated
func Template() (o *TemplateOpt) {
o = &TemplateOpt{
RendererGotenbergEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *TemplateOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Upgrade initializes and returns a UpgradeOpt with default values
//
// This function is auto-generated
func Upgrade() (o *UpgradeOpt) {
o = &UpgradeOpt{
Always: true,
Debug: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *UpgradeOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// WaitFor initializes and returns a WaitForOpt with default values
//
// This function is auto-generated
func WaitFor() (o *WaitForOpt) {
o = &WaitForOpt{
Delay: 0,
ServicesProbeInterval: time.Second * 5,
ServicesProbeTimeout: time.Second * 30,
ServicesTimeout: time.Minute,
StatusPage: true,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *WaitForOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Websocket initializes and returns a WebsocketOpt with default values
//
// This function is auto-generated
func Websocket() (o *WebsocketOpt) {
o = &WebsocketOpt{
PingPeriod: ((120 * time.Second) * 9) / 10,
PingTimeout: 120 * time.Second,
Timeout: 15 * time.Second,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *WebsocketOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
// Workflow initializes and returns a WorkflowOpt with default values
//
// This function is auto-generated
func Workflow() (o *WorkflowOpt) {
o = &WorkflowOpt{
CallStackSize: 16,
ExecDebug: false,
Register: true,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *WorkflowOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,36 +0,0 @@
package options
// 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/plugins.yaml
type (
PluginsOpt struct {
Enabled bool `env:"PLUGINS_ENABLED"`
Paths string `env:"PLUGINS_PATHS"`
}
)
// Plugins initializes and returns a PluginsOpt with default values
func Plugins() (o *PluginsOpt) {
o = &PluginsOpt{
Enabled: true,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Plugins) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,12 +0,0 @@
docs:
title: Plugins
description: Server plugins
props:
- name: Enabled
type: bool
default: true
description: Enable plugins
- name: Paths
description: List of colon seperated paths or patterns where plugins could be found

View File

@@ -1,37 +0,0 @@
package options
// 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
type (
ProvisionOpt struct {
Always bool `env:"PROVISION_ALWAYS"`
Path string `env:"PROVISION_PATH"`
}
)
// Provision initializes and returns a ProvisionOpt with default values
func Provision() (o *ProvisionOpt) {
o = &ProvisionOpt{
Always: true,
Path: "provision/*",
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Provision) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,23 +0,0 @@
docs:
title: Provisioning
intro: |-
Provisioning allows you to configure a {PRODUCT_NAME} instance when deployed.
It occurs automatically after the {PRODUCT_NAME} server starts.
[IMPORTANT]
====
We recommend you to keep provisioning enabled as it simplifies version updates by updating the database and updating settings.
If you're doing local development or some debugging, you can disable this.
====
props:
- name: always
type: bool
default: true
description: Controls if provision should run when the server starts.
- name: path
default: "provision/*"
description: Colon seperated paths to config files for provisioning.

View File

@@ -1,33 +0,0 @@
package options
// 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/seeder.yaml
type (
SeederOpt struct {
LogEnabled bool `env:"SEEDER_LOG_ENABLED"`
}
)
// Seeder initializes and returns a SeederOpt with default values
func Seeder() (o *SeederOpt) {
o = &SeederOpt{}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Seeder) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,8 +0,0 @@
docs:
title: Seeder
description: A seeder is the initial seeding of a database with fake data.
props:
- name: LogEnabled
type: bool
description: Enable extra logging // fixme add some more description

View File

@@ -1,49 +0,0 @@
package options
// 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
import (
"github.com/cortezaproject/corteza-server/pkg/version"
)
type (
SentryOpt struct {
DSN string `env:"SENTRY_DSN"`
Debug bool `env:"SENTRY_DEBUG"`
AttachStacktrace bool `env:"SENTRY_ATTACH_STACKTRACE"`
SampleRate float64 `env:"SENTRY_SAMPLE_RATE"`
MaxBreadcrumbs int `env:"SENTRY_MAX_BREADCRUMBS"`
ServerName string `env:"SENTRY_SERVERNAME"`
Release string `env:"SENTRY_RELEASE"`
Dist string `env:"SENTRY_DIST"`
Environment string `env:"SENTRY_ENVIRONMENT"`
}
)
// Sentry initializes and returns a SentryOpt with default values
func Sentry() (o *SentryOpt) {
o = &SentryOpt{
AttachStacktrace: true,
MaxBreadcrumbs: 0,
Release: version.Version,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Sentry) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,49 +0,0 @@
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.
- name: debug
type: bool
description: Print out debugging information.
- name: attachStacktrace
type: bool
default: true
description: Attach stacktraces
- name: sampleRate
type: float64
description: Sample rate for event submission (0.0 - 1.0. defaults to 1.0)
- name: maxBreadcrumbs
type: int
default: 0
description: Maximum number of bredcrumbs.
- name: serverName
env: SENTRY_SERVERNAME
description: Set reported Server name.
- name: release
default: version.Version
description: Set reported Release.
- name: dist
description: Set reported distribution.
- name: environment
description: Set reported environment.

View File

@@ -1,37 +0,0 @@
package options
// 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/template.yaml
type (
TemplateOpt struct {
RendererGotenbergAddress string `env:"TEMPLATE_RENDERER_GOTENBERG_ADDRESS"`
RendererGotenbergEnabled bool `env:"TEMPLATE_RENDERER_GOTENBERG_ENABLED"`
}
)
// Template initializes and returns a TemplateOpt with default values
func Template() (o *TemplateOpt) {
o = &TemplateOpt{
RendererGotenbergAddress: "",
RendererGotenbergEnabled: false,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Template) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,11 +0,0 @@
docs:
title: Rendering engine
props:
- name: rendererGotenbergAddress
default: ""
description: Gotenberg rendering container address.
- name: rendererGotenbergEnabled
type: bool
default: false
description: Is Gotenberg rendering container enabled.

View File

@@ -1,37 +0,0 @@
package options
// 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
type (
UpgradeOpt struct {
Debug bool `env:"UPGRADE_DEBUG"`
Always bool `env:"UPGRADE_ALWAYS"`
}
)
// Upgrade initializes and returns a UpgradeOpt with default values
func Upgrade() (o *UpgradeOpt) {
o = &UpgradeOpt{
Debug: false,
Always: true,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Upgrade) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,16 +0,0 @@
docs:
title: Data store (database) upgrade
props:
- 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.

View File

@@ -1,48 +0,0 @@
package options
// 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
import (
"time"
)
type (
WaitForOpt struct {
Delay time.Duration `env:"WAIT_FOR"`
StatusPage bool `env:"WAIT_FOR_STATUS_PAGE"`
Services string `env:"WAIT_FOR_SERVICES"`
ServicesTimeout time.Duration `env:"WAIT_FOR_SERVICES_TIMEOUT"`
ServicesProbeTimeout time.Duration `env:"WAIT_FOR_SERVICES_PROBE_TIMEOUT"`
ServicesProbeInterval time.Duration `env:"WAIT_FOR_SERVICES_PROBE_INTERVAL"`
}
)
// WaitFor initializes and returns a WaitForOpt with default values
func WaitFor() (o *WaitForOpt) {
o = &WaitForOpt{
Delay: 0,
StatusPage: true,
ServicesTimeout: time.Minute,
ServicesProbeTimeout: time.Second * 30,
ServicesProbeInterval: time.Second * 5,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *WaitFor) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,56 +0,0 @@
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
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
env: WAIT_FOR_STATUS_PAGE
default: true
description: Show temporary status web page.
- name: Services
env: WAIT_FOR_SERVICES
description: |-
Space delimited list of hosts and/or URLs to probe.
Host format: `host` or `host:443` (port will default to 80).
[NOTE]
====
Services are probed in parallel.
====
- 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
env: WAIT_FOR_SERVICES_PROBE_TIMEOUT
default: time.Second * 30
description: Timeout for each service probe.
- name: ServicesProbeInterval
type: time.Duration
env: WAIT_FOR_SERVICES_PROBE_INTERVAL
default: time.Second * 5
description: Interval between service probes.

View File

@@ -1,44 +0,0 @@
package options
// 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
import (
"time"
)
type (
WebsocketOpt struct {
LogEnabled bool `env:"WEBSOCKET_LOG_ENABLED"`
Timeout time.Duration `env:"WEBSOCKET_TIMEOUT"`
PingTimeout time.Duration `env:"WEBSOCKET_PING_TIMEOUT"`
PingPeriod time.Duration `env:"WEBSOCKET_PING_PERIOD"`
}
)
// Websocket initializes and returns a WebsocketOpt with default values
func Websocket() (o *WebsocketOpt) {
o = &WebsocketOpt{
Timeout: 15 * time.Second,
PingTimeout: 120 * time.Second,
PingPeriod: ((120 * time.Second) * 9) / 10,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Websocket) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,24 +0,0 @@
imports:
- time
docs:
title: Websocket server
description: A Websocket server emphasize the trigger events and actions.
props:
- name: LogEnabled
type: bool
description: Enable extra logging for authentication flows
- name: Timeout
type: time.Duration
default: 15 * time.Second
description: Time before `WsServer` gets timed out.
- name: PingTimeout
type: time.Duration
default: 120 * time.Second
- name: PingPeriod
type: time.Duration
default: ((120 * time.Second) * 9) / 10

View File

@@ -1,39 +0,0 @@
package options
// 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/workflow.yaml
type (
WorkflowOpt struct {
Register bool `env:"WORKFLOW_REGISTER"`
ExecDebug bool `env:"WORKFLOW_EXEC_DEBUG"`
CallStackSize int `env:"WORKFLOW_CALL_STACK_SIZE"`
}
)
// Workflow initializes and returns a WorkflowOpt with default values
func Workflow() (o *WorkflowOpt) {
o = &WorkflowOpt{
Register: true,
ExecDebug: false,
CallStackSize: 16,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Workflow) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}

View File

@@ -1,18 +0,0 @@
docs:
title: Workflow
props:
- name: register
type: bool
default: true
description: Registers enabled and valid workflows and executes them when triggered
- name: execDebug
type: bool
default: false
description: Enables verbose logging for workflow execution
- name: callStackSize
type: int
default: 16
description: Defines the maximum call stack size between workflows