Refactor option definitions

This commit is contained in:
Denis Arh
2022-02-08 09:13:56 +01:00
parent 440354e431
commit d103d60a3d
37 changed files with 479 additions and 471 deletions
+2 -2
View File
@@ -8,8 +8,8 @@ DB: schema.#optionsGroup & {
handle: "DB"
options: {
DSN: {
default: "\"sqlite3://file::memory:?cache=shared&mode=memory\""
description: "Database connection string."
defaultValue: "sqlite3://file::memory:?cache=shared&mode=memory"
description: "Database connection string."
}
}
title: "Connection to data store backend"
+6 -7
View File
@@ -5,9 +5,9 @@ import (
)
HTTPClient: schema.#optionsGroup & {
title: "HTTP Client"
title: "HTTP Client"
// Explicitly define all variants to be 100% compaltible with old name
handle: "http-client"
handle: "http-client"
// @todo remove explcitly defined expIdent and adjust the code
expIdent: "HTTPClient"
@@ -16,12 +16,9 @@ HTTPClient: schema.#optionsGroup & {
"\"time\"",
]
options: {
tls_insecure: {
type: "bool"
default: "false"
type: "bool"
description: """
Allow insecure (invalid, expired TLS/SSL certificates) connections.
@@ -33,8 +30,10 @@ HTTPClient: schema.#optionsGroup & {
}
timeout: {
type: "time.Duration"
default: "30 * time.Second"
description: "Default timeout for clients."
defaultGoExpr: "30 * time.Second"
defaultValue: "30s"
}
}
}
+45 -51
View File
@@ -5,8 +5,8 @@ import (
)
HTTPServer: schema.#optionsGroup & {
handle: "HTTPServer"
title: "HTTP Server"
handle: "http-server"
title: "HTTP Server"
imports: [
"\"github.com/cortezaproject/corteza-server/pkg/rand\"",
@@ -14,83 +14,78 @@ HTTPServer: schema.#optionsGroup & {
options: {
addr: {
default: "\":80\""
description: "IP and port for the HTTP server."
env: "HTTP_ADDR"
defaultValue: ":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"
type: "bool"
env: "HTTP_ERROR_TRACING"
}
enableHealthcheckRoute: {
type: "bool"
default: "true"
env: "HTTP_ENABLE_HEALTHCHECK_ROUTE"
type: "bool"
defaultGoExpr: "true"
env: "HTTP_ENABLE_HEALTHCHECK_ROUTE"
}
enableVersionRoute: {
type: "bool"
default: "true"
description: "Enable `/version` route."
env: "HTTP_ENABLE_VERSION_ROUTE"
type: "bool"
defaultGoExpr: "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"
defaultValue: "corteza"
description: "Name for metrics endpoint."
env: "HTTP_METRICS_NAME"
}
metricsUsername: {
default: "\"metrics\""
description: "Username for the metrics endpoint."
env: "HTTP_METRICS_USERNAME"
defaultValue: "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"
defaultGoExpr: "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"
type: "bool"
defaultGoExpr: "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"
defaultValue: "/"
description: "Base URL (prefix) for all routes (<baseUrl>/auth, <baseUrl>/api, ...)"
env: "HTTP_BASE_URL"
}
apiEnabled: {
type: "bool"
default: "true"
env: "HTTP_API_ENABLED"
type: "bool"
defaultGoExpr: "true"
env: "HTTP_API_ENABLED"
}
apiBaseUrl: {
default: "\"/\""
defaultValue: "/"
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
@@ -98,26 +93,25 @@ HTTPServer: schema.#optionsGroup & {
env: "HTTP_API_BASE_URL"
}
webappEnabled: {
type: "bool"
default: "false"
env: "HTTP_WEBAPP_ENABLED"
type: "bool"
env: "HTTP_WEBAPP_ENABLED"
}
webappBaseUrl: {
default: "\"/\""
description: "Webapp base URL is internaly prefixed with baseUrl"
env: "HTTP_WEBAPP_BASE_URL"
defaultValue: "/"
description: "Webapp base URL is internaly prefixed with baseUrl"
env: "HTTP_WEBAPP_BASE_URL"
}
webappBaseDir: {
default: "\"./webapp/public\""
env: "HTTP_WEBAPP_BASE_DIR"
defaultValue: "./webapp/public"
env: "HTTP_WEBAPP_BASE_DIR"
}
webappList: {
default: "\"admin,compose,workflow,reporter\""
env: "HTTP_WEBAPP_LIST"
defaultValue: "admin,compose,workflow,reporter"
env: "HTTP_WEBAPP_LIST"
}
sslTerminated: {
type: "bool"
default: "isSecure()"
type: "bool"
defaultGoExpr: "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.
+5 -5
View File
@@ -5,8 +5,8 @@ import (
)
RBAC: schema.#optionsGroup & {
handle: "RBAC"
title: "RBAC options"
handle: "rbac"
title: "RBAC options"
options: {
log: {
@@ -15,7 +15,7 @@ RBAC: schema.#optionsGroup & {
}
service_user: {}
bypass_roles: {
default: "\"super-admin\""
defaultValue: "super-admin"
description: """
Space delimited list of role handles.
These roles causes short-circuiting access control check and allowing all operations.
@@ -23,7 +23,7 @@ RBAC: schema.#optionsGroup & {
"""
}
authenticated_roles: {
default: "\"authenticated\""
defaultValue: "authenticated"
description: """
Space delimited list of role handles.
These roles are automatically assigned to authenticated user.
@@ -32,7 +32,7 @@ RBAC: schema.#optionsGroup & {
"""
}
anonymous_roles: {
default: "\"anonymous\""
defaultValue: "anonymous"
description: """
Space delimited list of role handles.
These roles are automatically assigned to anonymous user.
+10 -6
View File
@@ -5,16 +5,20 @@ import (
)
SCIM: schema.#optionsGroup & {
handle: "SCIM"
title: "SCIM Server"
handle: "scim"
title: "SCIM Server"
// @todo remove explicitly defined expIdent and adjust the code
expIdent: "SCIM"
options: {
enabled: {
type: "bool"
description: "Enable SCIM subsystem"
}
base_URL: {
default: "\"/scim\""
description: "Prefix for SCIM API endpoints"
defaultValue: "/scim"
description: "Prefix for SCIM API endpoints"
}
secret: {
description: "Secret to use to validate requests on SCIM API endpoints"
@@ -24,8 +28,8 @@ SCIM: schema.#optionsGroup & {
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"
defaultValue: "^[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"
}
}
}
+11 -8
View File
@@ -5,8 +5,12 @@ import (
)
SMTP: schema.#optionsGroup & {
handle: "SMTP"
title: "Email sending"
handle: "smpt"
title: "Email sending"
// @todo remove explicitly defined expIdent and adjust the code
expIdent: "SMTP"
intro: """
Configure your local SMTP server or use one of the available providers.
@@ -17,13 +21,13 @@ SMTP: schema.#optionsGroup & {
options: {
host: {
default: "\"localhost\""
description: "The SMTP server hostname."
defaultValue: "localhost"
description: "The SMTP server hostname."
}
port: {
type: "int"
default: "25"
description: "The SMTP post."
type: "int"
defaultGoExpr: "25"
description: "The SMTP post."
}
user: {
description: "The SMTP username."
@@ -36,7 +40,6 @@ SMTP: schema.#optionsGroup & {
}
tls_insecure: {
type: "bool"
default: "false"
description: "Allow insecure (invalid, expired TLS certificates) connections."
}
tls_server_name: {}
+4 -6
View File
@@ -8,16 +8,14 @@ actionLog: schema.#optionsGroup & {
handle: "actionLog"
options: {
enabled: {
type: "bool"
default: "true"
type: "bool"
defaultGoExpr: "true"
}
debug: {
type: "bool"
default: "false"
type: "bool"
}
workflow_functions_enabled: {
type: "bool"
default: "false"
type: "bool"
}
}
title: "Actionlog"
+10 -13
View File
@@ -13,39 +13,36 @@ apigw: schema.#optionsGroup & {
options: {
enabled: {
type: "bool"
default: "true"
description: "Enable API Gateway"
type: "bool"
defaultGoExpr: "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"
type: "bool"
defaultGoExpr: "true"
description: "Follow redirects on proxy requests"
}
proxy_outbound_timeout: {
type: "time.Duration"
default: "time.Second * 30"
description: "Outbound request timeout"
type: "time.Duration"
description: "Outbound request timeout"
defaultGoExpr: "time.Second * 30"
defaultValue: "30s"
}
}
title: "API Gateway"
+55 -43
View File
@@ -17,8 +17,8 @@ auth: schema.#optionsGroup & {
description: "Enable extra logging for authentication flows"
}
password_security: {
type: "bool"
default: "true"
type: "bool"
defaultGoExpr: "true"
description: """
Password security allows you to disable constraints to which passwords must conform to.
@@ -30,7 +30,7 @@ auth: schema.#optionsGroup & {
"""
}
secret: {
default: "getSecretFromEnv(\"jwt secret\")"
defaultGoExpr: "getSecretFromEnv(\"jwt secret\")"
description: """
Secret used for signing JWT tokens.
@@ -44,32 +44,37 @@ auth: schema.#optionsGroup & {
}
access_token_lifetime: {
type: "time.Duration"
default: "time.Hour * 2"
description: "Access token lifetime"
env: "AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME"
defaultGoExpr: "time.Hour * 2"
defaultValue: "2h"
}
refresh_token_lifetime: {
type: "time.Duration"
default: "time.Hour * 24 * 3"
description: "Refresh token lifetime"
env: "AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME"
defaultGoExpr: "time.Hour * 24 * 3"
defaultValue: "72h"
}
expiry: {
type: "time.Duration"
default: "time.Hour * 24 * 30"
description: "Experation time for the auth JWT tokens."
description: "Expiration time for the auth JWT tokens."
env: "AUTH_JWT_EXPIRY"
defaultGoExpr: "time.Hour * 24 * 30"
defaultValue: "720h"
}
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.
"""
defaultGoExpr: "fullURL(\"/auth/external/{provider}/callback\")"
}
external_cookie_secret: {
default: "getSecretFromEnv(\"external cookie secret\")"
description: """
Secret used for securing cookies
@@ -79,61 +84,69 @@ auth: schema.#optionsGroup & {
Generated secret will change if you change any of these variables.
====
"""
defaultGoExpr: "getSecretFromEnv(\"external cookie secret\")"
}
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.
"""
defaultGoExpr: "fullURL(\"/auth\")"
}
session_cookie_name: {
default: "\"session\""
description: "Session cookie name"
description: "Session cookie name"
defaultValue: "session"
}
session_cookie_path: {
default: "pathPrefix(\"/auth\")"
description: "Session cookie path"
description: "Session cookie path"
defaultGoExpr: "pathPrefix(\"/auth\")"
}
session_cookie_domain: {
default: "guessHostname()"
description: "Session cookie domain"
defaultGoExpr: "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"
type: "bool"
defaultGoExpr: "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"
type: "time.Duration"
description: "How long do we keep the temporary session"
defaultGoExpr: "24 * time.Hour"
defaultValue: "24h"
}
session_perm_lifetime: {
type: "time.Duration"
default: "360 * 24 * time.Hour"
description: "How long do we keep the permanent session"
type: "time.Duration"
description: "How long do we keep the permanent session"
defaultGoExpr: "360 * 24 * time.Hour"
defaultValue: "8640h"
}
garbage_collector_interval: {
type: "time.Duration"
default: "15 * time.Minute"
description: "How often are expired sessions and tokens purged from the database"
type: "time.Duration"
description: "How often are expired sessions and tokens purged from the database"
defaultGoExpr: "15 * time.Minute"
defaultValue: "15min"
}
request_rate_limit: {
type: "int"
default: "60"
type: "int"
description: """
How many requests from a cerain IP address are allowed in a time window.
Set to zero to disable
"""
defaultGoExpr: "60"
defaultValue: "60"
}
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"
type: "time.Duration"
defaultGoExpr: "time.Minute"
defaultValue: "1m"
description: "How many requests from a cerain IP address are allowed in a time window"
}
csrf_secret: {
default: "getSecretFromEnv(\"csrf secret\")"
defaultGoExpr: "getSecretFromEnv(\"csrf secret\")"
description: """
Secret used for securing CSRF protection
@@ -145,20 +158,20 @@ auth: schema.#optionsGroup & {
"""
}
csrf_enabled: {
type: "bool"
default: "true"
description: "Enable CSRF protection"
type: "bool"
defaultGoExpr: "true"
description: "Enable CSRF protection"
}
csrf_field_name: {
default: "\"same-site-authenticity-token\""
description: "Form field name used for CSRF protection"
defaultValue: "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"
defaultValue: "same-site-authenticity-token"
description: "Cookie name used for CSRF protection"
}
default_client: {
default: "\"corteza-webapp\""
defaultValue: "corteza-webapp"
description: """
Handle for OAuth2 client used for automatic redirect from /auth/oauth2/go endpoint.
@@ -168,7 +181,6 @@ auth: schema.#optionsGroup & {
"""
}
assets_path: {
default: ""
description: """
Path to js, css, images and template source files
+28 -28
View File
@@ -14,59 +14,59 @@ corredor: schema.#optionsGroup & {
options: {
enabled: {
type: "bool"
default: "false"
description: "Enable/disable Corredor integration"
}
addr: {
default: "\"localhost:50051\""
description: "Hostname and port of the Corredor gRPC server."
defaultValue: "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."
type: "time.Duration"
description: "Max delay for backoff on connection."
defaultGoExpr: "time.Minute"
defaultValue: "1m"
}
max_receive_message_size: {
type: "int"
default: "2 << 23"
description: "Max message size that can be recived."
type: "int"
defaultGoExpr: "2 << 23"
description: "Max message size that can be recived."
}
default_exec_timeout: {
type: "time.Duration"
default: "time.Minute"
type: "time.Duration"
defaultGoExpr: "time.Minute"
}
list_timeout: {
type: "time.Duration"
default: "time.Second * 2"
type: "time.Duration"
defaultGoExpr: "time.Second * 2"
defaultValue: "2s"
}
list_refresh: {
type: "time.Duration"
default: "time.Second * 5"
type: "time.Duration"
defaultGoExpr: "time.Second * 5"
}
run_as_enabled: {
type: "bool"
default: "true"
type: "bool"
defaultGoExpr: "true"
}
tls_cert_enabled: {
type: "bool"
default: "false"
env: "CORREDOR_CLIENT_CERTIFICATES_ENABLED"
type: "bool"
env: "CORREDOR_CLIENT_CERTIFICATES_ENABLED"
}
tls_cert_path: {
default: "\"/certs/corredor/client\""
env: "CORREDOR_CLIENT_CERTIFICATES_PATH"
defaultValue: "/certs/corredor/client"
env: "CORREDOR_CLIENT_CERTIFICATES_PATH"
}
tls_cert_cA: {
default: "\"ca.crt\""
env: "CORREDOR_CLIENT_CERTIFICATES_CA"
defaultValue: "ca.crt"
env: "CORREDOR_CLIENT_CERTIFICATES_CA"
}
tls_cert_private: {
default: "\"private.key\""
env: "CORREDOR_CLIENT_CERTIFICATES_PRIVATE"
defaultValue: "private.key"
env: "CORREDOR_CLIENT_CERTIFICATES_PRIVATE"
}
tls_cert_public: {
default: "\"public.crt\""
env: "CORREDOR_CLIENT_CERTIFICATES_PUBLIC"
defaultValue: "public.crt"
env: "CORREDOR_CLIENT_CERTIFICATES_PUBLIC"
}
tls_server_name: {
env: "CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME"
+2 -2
View File
@@ -8,8 +8,8 @@ environment: schema.#optionsGroup & {
handle: "environment"
options: {
environment: {
default: "\"production\""
env: "ENVIRONMENT"
defaultValue: "production"
env: "ENVIRONMENT"
}
}
title: "Environment"
+6 -4
View File
@@ -13,14 +13,16 @@ eventbus: schema.#optionsGroup & {
options: {
scheduler_enabled: {
type: "bool"
default: "true"
description: "Enable eventbus sheduler."
type: "bool"
defaultGoExpr: "true"
description: "Enable eventbus scheduler."
}
scheduler_interval: {
type: "time.Duration"
default: "time.Minute"
description: "Set time interval for `eventbus` scheduler."
defaultGoExpr: "time.Minute"
defaultValue: "60s"
}
}
title: "Events and scheduler"
+26 -23
View File
@@ -14,42 +14,45 @@ federation: schema.#optionsGroup & {
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"
type: "string"
defaultValue: "federated"
description: "Federation label"
}
host: {
type: "string"
default: "\"local.cortezaproject.org\""
description: "Host that is used during node pairing, also included in invitation"
type: "string"
defaultValue: "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"
type: "time.Duration"
defaultGoExpr: "time.Minute * 2"
defaultValue: "2m"
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"
type: "int"
defaultGoExpr: "1"
defaultValue: "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"
type: "time.Duration"
defaultGoExpr: "time.Minute "
defaultValue: "1m"
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"
type: "int"
defaultGoExpr: "100"
defaultValue: "100"
description: "Bulk size in fetching for data sync"
env: "FEDERATION_SYNC_DATA_PAGE_SIZE"
}
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ locale: schema.#optionsGroup & {
handle: "locale"
options: {
languages: {
default: "\"en\""
defaultValue: "en"
description: """
List of compa delimited languages (language tags) to enable.
In case when an enabled language can not be loaded, error is logged.
@@ -23,7 +23,7 @@ locale: schema.#optionsGroup & {
}
query_string_param: {
default: "\"lng\""
defaultValue: "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.
+3 -4
View File
@@ -17,7 +17,7 @@ log: schema.#optionsGroup & {
"""
}
level: {
default: "\"warn\""
defaultValue: "warn"
description: """
Minimum logging level. If set to "warn",
Levels warn, error, dpanic panic and fatal will be logged.
@@ -45,8 +45,7 @@ log: schema.#optionsGroup & {
"""
}
include_caller: {
type: "bool"
default: "false"
type: "bool"
description: """
Set to true to see where the logging was called from.
@@ -55,7 +54,7 @@ log: schema.#optionsGroup & {
"""
}
stacktrace_level: {
default: "\"dpanic\""
defaultValue: "dpanic"
description: """
Include stack-trace when logging at a specified level or below.
Disable for production.
+3 -4
View File
@@ -8,13 +8,12 @@ messagebus: schema.#optionsGroup & {
handle: "messagebus"
options: {
Enabled: {
type: "bool"
default: "true"
description: "Enable messagebus"
type: "bool"
defaultGoExpr: "true"
description: "Enable messagebus"
}
log_enabled: {
type: "bool"
default: "false"
description: "Enable extra logging for messagebus watchers"
}
}
+4 -3
View File
@@ -13,9 +13,10 @@ monitor: schema.#optionsGroup & {
options: {
interval: {
type: "time.Duration"
default: "300 * time.Second"
description: "Output (log) interval for monitoring."
type: "time.Duration"
defaultGoExpr: "5 * time.Minute"
defaultValue: "5m"
description: "Output (log) interval for monitoring."
}
}
title: "Monitoring"
+14 -14
View File
@@ -5,22 +5,23 @@ import (
)
objectStore: schema.#optionsGroup & {
handle: "ObjectStore"
title: "Object (file) storage"
handle: "object-store"
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"
defaultValue: "var/store"
description: "Location where uploaded files are stored."
env: "STORAGE_PATH"
}
minioEndpoint: {
env: "MINIO_ENDPOINT"
}
minioSecure: {
type: "bool"
default: "true"
env: "MINIO_SECURE"
type: "bool"
defaultGoExpr: "true"
env: "MINIO_SECURE"
}
minioAccessKey: {
env: "MINIO_ACCESS_KEY"
@@ -32,18 +33,17 @@ objectStore: schema.#optionsGroup & {
env: "MINIO_SSEC_KEY"
}
minioBucket: {
default: "\"{component}\""
description: "`component` placeholder is replaced with service name (e.g system)."
env: "MINIO_BUCKET"
defaultValue: "{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"
type: "bool"
env: "MINIO_STRICT"
}
}
}
+3 -3
View File
@@ -8,9 +8,9 @@ plugins: schema.#optionsGroup & {
handle: "plugins"
options: {
Enabled: {
type: "bool"
default: "true"
description: "Enable plugins"
type: "bool"
defaultGoExpr: "true"
description: "Enable plugins"
}
Paths: {
description: "List of colon seperated paths or patterns where plugins could be found"
+5 -5
View File
@@ -8,13 +8,13 @@ provision: schema.#optionsGroup & {
handle: "provision"
options: {
always: {
type: "bool"
default: "true"
description: "Controls if provision should run when the server starts."
type: "bool"
defaultGoExpr: "true"
description: "Controls if provision should run when the server starts."
}
path: {
default: "\"provision/*\""
description: "Colon seperated paths to config files for provisioning."
defaultValue: "provision/*"
description: "Colon seperated paths to config files for provisioning."
}
}
title: "Provisioning"
+9 -9
View File
@@ -8,7 +8,7 @@ sentry: schema.#optionsGroup & {
handle: "sentry"
imports: [
"\"github.com/cortezaproject/corteza-server/pkg/version\""
"\"github.com/cortezaproject/corteza-server/pkg/version\"",
]
title: "Sentry monitoring"
@@ -31,26 +31,26 @@ sentry: schema.#optionsGroup & {
description: "Print out debugging information."
}
attach_stacktrace: {
type: "bool"
default: "true"
description: "Attach stacktraces"
type: "bool"
defaultGoExpr: "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."
type: "int"
defaultGoExpr: "0"
description: "Maximum number of bredcrumbs."
}
server_name: {
description: "Set reported Server name."
env: "SENTRY_SERVERNAME"
}
release: {
default: "version.Version"
description: "Set reported Release."
defaultGoExpr: "version.Version"
description: "Set reported Release."
}
dist: {
description: "Set reported distribution."
+3 -4
View File
@@ -6,17 +6,16 @@ import (
template: schema.#optionsGroup & {
handle: "template"
title: "Rendering engine"
title: "Rendering engine"
options: {
renderer_gotenberg_address: {
default: ""
description: "Gotenberg rendering container address."
defaultGoExpr: ""
description: "Gotenberg rendering container address."
}
renderer_gotenberg_enabled: {
type: "bool"
default: "false"
description: "Is Gotenberg rendering container enabled."
}
}
+5 -6
View File
@@ -6,21 +6,20 @@ import (
upgrade: schema.#optionsGroup & {
handle: "upgrade"
title: "Data store (database) upgrade"
title: "Data store (database) upgrade"
options: {
debug: {
type: "bool"
default: "false"
type: "bool"
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."
type: "bool"
defaultGoExpr: "true"
description: "Controls if the upgradable systems should be upgraded when the server starts."
}
}
}
+20 -18
View File
@@ -22,8 +22,7 @@ waitFor: schema.#optionsGroup & {
options: {
delay: {
type: "time.Duration"
default: "0"
type: "time.Duration"
description: """
Delays API startup for the amount of time specified (10s, 2m...).
This delay happens before service (`WAIT_FOR_SERVICES`) probing.
@@ -31,10 +30,10 @@ waitFor: schema.#optionsGroup & {
env: "WAIT_FOR"
}
status_page: {
type: "bool"
default: "true"
description: "Show temporary status web page."
env: "WAIT_FOR_STATUS_PAGE"
type: "bool"
defaultGoExpr: "true"
description: "Show temporary status web page."
env: "WAIT_FOR_STATUS_PAGE"
}
services: {
@@ -51,24 +50,27 @@ waitFor: schema.#optionsGroup & {
}
services_timeout: {
type: "time.Duration"
default: "time.Minute"
description: "Max time for each service probe."
env: "WAIT_FOR_SERVICES_TIMEOUT"
type: "time.Duration"
defaultGoExpr: "time.Minute"
defaultValue: "1m"
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"
type: "time.Duration"
defaultGoExpr: "time.Second * 30"
defaultValue: "30s"
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"
type: "time.Duration"
defaultGoExpr: "time.Second * 5"
defaultValue: "5s"
description: "Interval between service probes."
env: "WAIT_FOR_SERVICES_PROBE_INTERVAL"
}
}
}
+10 -5
View File
@@ -19,16 +19,21 @@ websocket: schema.#optionsGroup & {
}
timeout: {
type: "time.Duration"
default: "15 * time.Second"
description: "Time before `WsServer` gets timed out."
defaultGoExpr: "15 * time.Second"
defaultValue: "15s"
}
ping_timeout: {
type: "time.Duration"
default: "120 * time.Second"
type: "time.Duration"
defaultGoExpr: "120 * time.Second"
defaultValue: "120s"
}
ping_period: {
type: "time.Duration"
default: "((120 * time.Second) * 9) / 10"
type: "time.Duration"
defaultGoExpr: "((120 * time.Second) * 9) / 10"
defaultValue: "119s"
}
}
}
+6 -7
View File
@@ -8,19 +8,18 @@ workflow: schema.#optionsGroup & {
handle: "workflow"
options: {
register: {
type: "bool"
default: "true"
description: "Registers enabled and valid workflows and executes them when triggered"
type: "bool"
defaultGoExpr: "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"
type: "int"
defaultGoExpr: "16"
description: "Defines the maximum call stack size between workflows"
}
}
title: "Workflow"
@@ -27,7 +27,7 @@ type (
func {{ .func }}() (o *{{ .struct }}) {
o = &{{ .struct }}{
{{- range .options }}
{{- if .default }}
{{- if or .default }}
{{ .expIdent }}: {{ .default }},
{{- end }}
{{- end }}
+17 -6
View File
@@ -29,14 +29,25 @@ options:
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
}
for g in app.corteza.options {
func: g.expIdent
struct: g.expIdent + "Opt"
options: [
for o in g.options {
o
default?: string
if (o.defaultGoExpr != _|_) {
default: o.defaultGoExpr
}
if (o.defaultGoExpr == _|_ && o.defaultValue != _|_) {
default: "\"" + o.defaultValue + "\""
}
},
]
},
]
}
},
]
+16 -10
View File
@@ -4,30 +4,30 @@ import (
"strings"
)
#_ENV: =~ "^[A-Z][A-Z0-9_]*[A-Z0-9]?$"
#_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
handle: #handle
title?: string
description?: string
title: string | *handle
description?: string
env: #_ENV | *(strings.ToUpper(strings.Replace(handle, "-", "_", -1)))
env: #_ENV | *(strings.ToUpper(strings.Replace(handle, "-", "_", -1)))
_envPrefix: env
options: {
[_opt=_]: #option & {
handle: _opt
env: #_ENV | *(_envPrefix + "_" + strings.ToUpper(strings.Replace(handle, " ", "_", -1)))
handle: _opt
env: #_ENV | *(_envPrefix + "_" + strings.ToUpper(strings.Replace(handle, " ", "_", -1)))
}
}
}
#option: {
handle: #handle
handle: #handle
_words: strings.Replace(strings.Replace(strings.Replace(handle, "-", " ", -1), "_", " ", -1), ".", " ", -1)
// lowercased (unexported, golang) identifier
@@ -36,8 +36,14 @@ import (
// upercased (exported, golang) identifier
expIdent: #expIdent | *strings.Replace(strings.ToTitle(_words), " ", "", -1)
type: string | *"string"
type: string | *"string"
description?: string
default?: string
// Default expression to be used
defaultGoExpr?: string
env?: #_ENV
// Plain default value to use when generating .env.example
defaultValue?: string
}
+1 -1
View File
@@ -68,7 +68,7 @@ func Node(s store.Storer, u service.UserService, al actionlog.Recorder, th token
name: options.Label,
host: options.Host,
// @todo use HTTP_API_BASE_URL (HTTPServerOpt.ApiBaseUrl) to prefix URI path
// @todo use HTTP_API_BASE_URL (HttpServerOpt.ApiBaseUrl) to prefix URI path
baseURL: "/federation",
handshaker: HttpHandshake(http.DefaultClient),
+2 -2
View File
@@ -20,14 +20,14 @@ import (
type (
server struct {
log *zap.Logger
httpOpt options.HTTPServerOpt
httpOpt options.HttpServerOpt
waitForOpt options.WaitForOpt
environmentOpt options.EnvironmentOpt
endpoints []func(r chi.Router)
}
)
func New(log *zap.Logger, envOpt options.EnvironmentOpt, httpOpt options.HTTPServerOpt, waitForOpt options.WaitForOpt) *server {
func New(log *zap.Logger, envOpt options.EnvironmentOpt, httpOpt options.HttpServerOpt, waitForOpt options.WaitForOpt) *server {
return &server{
endpoints: make([]func(r chi.Router), 0),
log: log.Named("http"),
+1 -1
View File
@@ -1,6 +1,6 @@
package options
func (o *HTTPServerOpt) Defaults() {
func (o *HttpServerOpt) Defaults() {
o.BaseUrl = CleanBase(o.BaseUrl)
o.ApiBaseUrl = CleanBase(o.ApiBaseUrl)
o.WebappBaseUrl = CleanBase(o.WebappBaseUrl)
+136 -160
View File
@@ -7,9 +7,10 @@ package options
//
import (
"time"
"github.com/cortezaproject/corteza-server/pkg/rand"
"github.com/cortezaproject/corteza-server/pkg/version"
"time"
)
type (
@@ -18,68 +19,68 @@ type (
}
HTTPClientOpt struct {
Timeout time.Duration `env:"HTTP_CLIENT_TIMEOUT"`
TlsInsecure bool `env:"HTTP_CLIENT_TLS_INSECURE"`
Timeout time.Duration `env:"HTTP_CLIENT_TIMEOUT"`
}
HTTPServerOpt struct {
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"`
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"`
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"`
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"`
}
RBACOpt struct {
AnonymousRoles string `env:"RBAC_ANONYMOUS_ROLES"`
AuthenticatedRoles string `env:"RBAC_AUTHENTICATED_ROLES"`
BypassRoles string `env:"RBAC_BYPASS_ROLES"`
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"`
}
SCIMOpt struct {
BaseURL string `env:"SCIM_BASE_URL"`
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"`
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"`
Host string `env:"SMPT_HOST"`
Port int `env:"SMPT_PORT"`
User string `env:"SMPT_USER"`
Pass string `env:"SMPT_PASS"`
From string `env:"SMPT_FROM"`
TlsInsecure bool `env:"SMPT_TLS_INSECURE"`
TlsServerName string `env:"SMPT_TLS_SERVER_NAME"`
}
ActionLogOpt struct {
Debug bool `env:"ACTIONLOG_DEBUG"`
Enabled bool `env:"ACTIONLOG_ENABLED"`
Debug bool `env:"ACTIONLOG_DEBUG"`
WorkflowFunctionsEnabled bool `env:"ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED"`
}
ApigwOpt struct {
Debug bool `env:"APIGW_DEBUG"`
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"`
@@ -88,45 +89,45 @@ type (
}
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"`
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"`
}
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"`
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"`
TlsCertCA string `env:"CORREDOR_CLIENT_CERTIFICATES_CA"`
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"`
@@ -142,13 +143,13 @@ type (
}
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"`
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"`
}
LimitOpt struct {
@@ -156,19 +157,19 @@ type (
}
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"`
Log bool `env:"LOCALE_LOG"`
DevelopmentMode bool `env:"LOCALE_DEVELOPMENT_MODE"`
}
LogOpt struct {
Debug bool `env:"LOG_DEBUG"`
Level string `env:"LOG_LEVEL"`
Filter string `env:"LOG_FILTER"`
IncludeCaller bool `env:"LOG_INCLUDE_CALLER"`
Level string `env:"LOG_LEVEL"`
StacktraceLevel string `env:"LOG_STACKTRACE_LEVEL"`
}
@@ -182,15 +183,15 @@ type (
}
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"`
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"`
}
PluginsOpt struct {
@@ -209,14 +210,14 @@ type (
SentryOpt struct {
DSN string `env:"SENTRY_DSN"`
AttachStacktrace bool `env:"SENTRY_ATTACH_STACKTRACE"`
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"`
MaxBreadcrumbs int `env:"SENTRY_MAX_BREADCRUMBS"`
Release string `env:"SENTRY_RELEASE"`
SampleRate float64 `env:"SENTRY_SAMPLE_RATE"`
ServerName string `env:"SENTRY_SERVERNAME"`
}
TemplateOpt struct {
@@ -225,30 +226,30 @@ type (
}
UpgradeOpt struct {
Always bool `env:"UPGRADE_ALWAYS"`
Debug bool `env:"UPGRADE_DEBUG"`
Always bool `env:"UPGRADE_ALWAYS"`
}
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"`
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"`
}
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"`
PingTimeout time.Duration `env:"WEBSOCKET_PING_TIMEOUT"`
PingPeriod time.Duration `env:"WEBSOCKET_PING_PERIOD"`
}
WorkflowOpt struct {
CallStackSize int `env:"WORKFLOW_CALL_STACK_SIZE"`
ExecDebug bool `env:"WORKFLOW_EXEC_DEBUG"`
Register bool `env:"WORKFLOW_REGISTER"`
ExecDebug bool `env:"WORKFLOW_EXEC_DEBUG"`
CallStackSize int `env:"WORKFLOW_CALL_STACK_SIZE"`
}
)
@@ -279,8 +280,7 @@ func DB() (o *DBOpt) {
// This function is auto-generated
func HTTPClient() (o *HTTPClientOpt) {
o = &HTTPClientOpt{
Timeout: 30 * time.Second,
TlsInsecure: false,
Timeout: 30 * time.Second,
}
fill(o)
@@ -297,38 +297,32 @@ func HTTPClient() (o *HTTPClientOpt) {
return
}
// HTTPServer initializes and returns a HTTPServerOpt with default values
// HttpServer initializes and returns a HttpServerOpt with default values
//
// This function is auto-generated
func HTTPServer() (o *HTTPServerOpt) {
o = &HTTPServerOpt{
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",
MetricsPassword: string(rand.Bytes(5)),
EnablePanicReporting: true,
BaseUrl: "/",
ApiEnabled: true,
ApiBaseUrl: "/",
WebappBaseUrl: "/",
WebappEnabled: false,
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 *HTTPServerOpt) Defaults() {...}
// func (o *HttpServerOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
@@ -338,21 +332,21 @@ func HTTPServer() (o *HTTPServerOpt) {
return
}
// RBAC initializes and returns a RBACOpt with default values
// Rbac initializes and returns a RbacOpt with default values
//
// This function is auto-generated
func RBAC() (o *RBACOpt) {
o = &RBACOpt{
AnonymousRoles: "anonymous",
AuthenticatedRoles: "authenticated",
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 *RBACOpt) Defaults() {...}
// func (o *RbacOpt) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
@@ -390,9 +384,8 @@ func SCIM() (o *SCIMOpt) {
// This function is auto-generated
func SMTP() (o *SMTPOpt) {
o = &SMTPOpt{
Host: "localhost",
Port: 25,
TlsInsecure: false,
Host: "localhost",
Port: 25,
}
fill(o)
@@ -414,9 +407,7 @@ func SMTP() (o *SMTPOpt) {
// This function is auto-generated
func ActionLog() (o *ActionLogOpt) {
o = &ActionLogOpt{
Debug: false,
Enabled: true,
WorkflowFunctionsEnabled: false,
Enabled: true,
}
fill(o)
@@ -438,11 +429,7 @@ func ActionLog() (o *ActionLogOpt) {
// 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,
}
@@ -466,28 +453,28 @@ func Apigw() (o *ApigwOpt) {
// 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(),
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",
}
fill(o)
@@ -510,16 +497,14 @@ func Auth() (o *AuthOpt) {
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,
DefaultExecTimeout: time.Minute,
ListTimeout: time.Second * 2,
ListRefresh: time.Second * 5,
RunAsEnabled: true,
TlsCertCA: "ca.crt",
TlsCertEnabled: false,
TlsCertPath: "/certs/corredor/client",
TlsCertCA: "ca.crt",
TlsCertPrivate: "private.key",
TlsCertPublic: "public.crt",
}
@@ -588,13 +573,12 @@ func Eventbus() (o *EventbusOpt) {
// 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",
Host: "local.cortezaproject.org",
StructureMonitorInterval: time.Minute * 2,
StructurePageSize: 1,
DataMonitorInterval: time.Minute,
DataPageSize: 100,
}
fill(o)
@@ -659,7 +643,6 @@ func Locale() (o *LocaleOpt) {
// This function is auto-generated
func Log() (o *LogOpt) {
o = &LogOpt{
IncludeCaller: false,
Level: "warn",
StacktraceLevel: "dpanic",
}
@@ -683,8 +666,7 @@ func Log() (o *LogOpt) {
// This function is auto-generated
func Messagebus() (o *MessagebusOpt) {
o = &MessagebusOpt{
Enabled: true,
LogEnabled: false,
Enabled: true,
}
fill(o)
@@ -706,7 +688,7 @@ func Messagebus() (o *MessagebusOpt) {
// This function is auto-generated
func Monitor() (o *MonitorOpt) {
o = &MonitorOpt{
Interval: 300 * time.Second,
Interval: 5 * time.Minute,
}
fill(o)
@@ -728,10 +710,9 @@ func Monitor() (o *MonitorOpt) {
// This function is auto-generated
func ObjectStore() (o *ObjectStoreOpt) {
o = &ObjectStoreOpt{
MinioBucket: "{component}",
MinioSecure: true,
MinioStrict: false,
Path: "var/store",
MinioSecure: true,
MinioBucket: "{component}",
}
fill(o)
@@ -841,9 +822,7 @@ func Sentry() (o *SentryOpt) {
//
// This function is auto-generated
func Template() (o *TemplateOpt) {
o = &TemplateOpt{
RendererGotenbergEnabled: false,
}
o = &TemplateOpt{}
fill(o)
@@ -865,7 +844,6 @@ func Template() (o *TemplateOpt) {
func Upgrade() (o *UpgradeOpt) {
o = &UpgradeOpt{
Always: true,
Debug: false,
}
fill(o)
@@ -887,11 +865,10 @@ func Upgrade() (o *UpgradeOpt) {
// 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,
ServicesTimeout: time.Minute,
ServicesProbeTimeout: time.Second * 30,
ServicesProbeInterval: time.Second * 5,
}
fill(o)
@@ -913,9 +890,9 @@ func WaitFor() (o *WaitForOpt) {
// 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,
PingTimeout: 120 * time.Second,
PingPeriod: ((120 * time.Second) * 9) / 10,
}
fill(o)
@@ -937,9 +914,8 @@ func Websocket() (o *WebsocketOpt) {
// This function is auto-generated
func Workflow() (o *WorkflowOpt) {
o = &WorkflowOpt{
CallStackSize: 16,
ExecDebug: false,
Register: true,
CallStackSize: 16,
}
fill(o)
+4 -4
View File
@@ -16,14 +16,14 @@ type (
Corredor CorredorOpt
Monitor MonitorOpt
WaitFor WaitForOpt
HTTPServer HTTPServerOpt
HTTPServer HttpServerOpt
Websocket WebsocketOpt
Eventbus EventbusOpt
Messagebus MessagebusOpt
Federation FederationOpt
SCIM SCIMOpt
Workflow WorkflowOpt
RBAC RBACOpt
RBAC RbacOpt
Locale LocaleOpt
Limit LimitOpt
Plugins PluginsOpt
@@ -46,14 +46,14 @@ func Init() *Options {
Corredor: *Corredor(),
Monitor: *Monitor(),
WaitFor: *WaitFor(),
HTTPServer: *HTTPServer(),
HTTPServer: *HttpServer(),
Websocket: *Websocket(),
Eventbus: *Eventbus(),
Messagebus: *Messagebus(),
Federation: *Federation(),
SCIM: *SCIM(),
Workflow: *Workflow(),
RBAC: *RBAC(),
RBAC: *Rbac(),
Locale: *Locale(),
Limit: *Limit(),
Plugins: *Plugins(),
+2 -2
View File
@@ -20,7 +20,7 @@ var (
baseHrefMatcher = regexp.MustCompile(`<base\s+href="?.+?"?\s*\/?>`)
)
func MakeWebappServer(log *zap.Logger, httpSrvOpt options.HTTPServerOpt, authOpt options.AuthOpt) func(r chi.Router) {
func MakeWebappServer(log *zap.Logger, httpSrvOpt options.HttpServerOpt, authOpt options.AuthOpt) func(r chi.Router) {
var (
apiBaseUrl = options.CleanBase(httpSrvOpt.BaseUrl, httpSrvOpt.ApiBaseUrl)
apps = strings.Split(httpSrvOpt.WebappList, ",")
@@ -59,7 +59,7 @@ func MakeWebappServer(log *zap.Logger, httpSrvOpt options.HTTPServerOpt, authOpt
}
// Serves index.html in case the requested file isn't found (or some other os.Stat error)
func serveIndex(opt options.HTTPServerOpt, indexHTML []byte, serve http.Handler) http.HandlerFunc {
func serveIndex(opt options.HttpServerOpt, indexHTML []byte, serve http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
requestedFile := path.Join(
+1 -1
View File
@@ -762,7 +762,7 @@ func toLabeledRoles(set []*types.Role) []label.LabeledResource {
// Initializes roles to RBAC and default role service
//
// Sets all closed & system roles
func initRoles(ctx context.Context, log *zap.Logger, opt options.RBACOpt, eb eventbusRoleChangeRegistry, ru rbacRoleUpdater) (err error) {
func initRoles(ctx context.Context, log *zap.Logger, opt options.RbacOpt, eb eventbusRoleChangeRegistry, ru rbacRoleUpdater) (err error) {
var (
// splits space separated string into map
s = func(l string) (map[string]bool, error) {
+1 -1
View File
@@ -32,7 +32,7 @@ type (
Storage options.ObjectStoreOpt
Template options.TemplateOpt
Auth options.AuthOpt
RBAC options.RBACOpt
RBAC options.RbacOpt
Limit options.LimitOpt
}