From d103d60a3d18dd5f20ad8f59482c960620862203 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sun, 6 Feb 2022 16:07:39 +0100 Subject: [PATCH] Refactor option definitions --- app/options/DB.cue | 4 +- app/options/HTTPClient.cue | 13 +- app/options/HTTPServer.cue | 96 +++--- app/options/RBAC.cue | 10 +- app/options/SCIM.cue | 16 +- app/options/SMTP.cue | 19 +- app/options/actionLog.cue | 10 +- app/options/apigw.cue | 23 +- app/options/auth.cue | 98 +++--- app/options/corredor.cue | 56 ++-- app/options/environment.cue | 4 +- app/options/eventbus.cue | 10 +- app/options/federation.cue | 49 +-- app/options/locale.cue | 4 +- app/options/log.cue | 7 +- app/options/messagebus.cue | 7 +- app/options/monitor.cue | 7 +- app/options/object_store.cue | 28 +- app/options/plugins.cue | 6 +- app/options/provision.cue | 10 +- app/options/sentry.cue | 18 +- app/options/template.cue | 7 +- app/options/upgrade.cue | 11 +- app/options/waitFor.cue | 38 +-- app/options/websocket.cue | 15 +- app/options/workflow.cue | 13 +- .../templates/gocode/options/options.go.tpl | 2 +- codegen/options.cue | 23 +- codegen/schema/options.cue | 26 +- federation/service/node.go | 2 +- pkg/api/server/server.go | 4 +- pkg/options/HTTPServer.go | 2 +- pkg/options/options.gen.go | 296 ++++++++---------- pkg/options/options.go | 8 +- pkg/webapp/serve.go | 4 +- system/service/role.go | 2 +- system/service/service.go | 2 +- 37 files changed, 479 insertions(+), 471 deletions(-) diff --git a/app/options/DB.cue b/app/options/DB.cue index a5c41ad15..cc2d43af1 100644 --- a/app/options/DB.cue +++ b/app/options/DB.cue @@ -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" diff --git a/app/options/HTTPClient.cue b/app/options/HTTPClient.cue index bbac29cde..3d3296a89 100644 --- a/app/options/HTTPClient.cue +++ b/app/options/HTTPClient.cue @@ -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" } } } diff --git a/app/options/HTTPServer.cue b/app/options/HTTPServer.cue index b601c739a..57502e37e 100644 --- a/app/options/HTTPServer.cue +++ b/app/options/HTTPServer.cue @@ -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 (/auth, /api, ...)" - env: "HTTP_BASE_URL" + defaultValue: "/" + description: "Base URL (prefix) for all routes (/auth, /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. diff --git a/app/options/RBAC.cue b/app/options/RBAC.cue index 7f07e82f8..c72b14ead 100644 --- a/app/options/RBAC.cue +++ b/app/options/RBAC.cue @@ -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. diff --git a/app/options/SCIM.cue b/app/options/SCIM.cue index 4f6eebb67..61785e28d 100644 --- a/app/options/SCIM.cue +++ b/app/options/SCIM.cue @@ -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" } } } diff --git a/app/options/SMTP.cue b/app/options/SMTP.cue index d4a5652d0..b339b8853 100644 --- a/app/options/SMTP.cue +++ b/app/options/SMTP.cue @@ -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: {} diff --git a/app/options/actionLog.cue b/app/options/actionLog.cue index b453c6afc..c3e8bedef 100644 --- a/app/options/actionLog.cue +++ b/app/options/actionLog.cue @@ -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" diff --git a/app/options/apigw.cue b/app/options/apigw.cue index c761d2bf6..291db6aed 100644 --- a/app/options/apigw.cue +++ b/app/options/apigw.cue @@ -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" diff --git a/app/options/auth.cue b/app/options/auth.cue index 29830eecb..fdb845398 100644 --- a/app/options/auth.cue +++ b/app/options/auth.cue @@ -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 diff --git a/app/options/corredor.cue b/app/options/corredor.cue index 21bda5594..87153db99 100644 --- a/app/options/corredor.cue +++ b/app/options/corredor.cue @@ -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" diff --git a/app/options/environment.cue b/app/options/environment.cue index 9931bbc2e..a8da49e5f 100644 --- a/app/options/environment.cue +++ b/app/options/environment.cue @@ -8,8 +8,8 @@ environment: schema.#optionsGroup & { handle: "environment" options: { environment: { - default: "\"production\"" - env: "ENVIRONMENT" + defaultValue: "production" + env: "ENVIRONMENT" } } title: "Environment" diff --git a/app/options/eventbus.cue b/app/options/eventbus.cue index c9e0a5042..41a7c92e1 100644 --- a/app/options/eventbus.cue +++ b/app/options/eventbus.cue @@ -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" diff --git a/app/options/federation.cue b/app/options/federation.cue index cb7b908fc..dcd8dd69b 100644 --- a/app/options/federation.cue +++ b/app/options/federation.cue @@ -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" } } } diff --git a/app/options/locale.cue b/app/options/locale.cue index 507bb897b..1aef0dce3 100644 --- a/app/options/locale.cue +++ b/app/options/locale.cue @@ -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. diff --git a/app/options/log.cue b/app/options/log.cue index 4448dec4b..1e9e3f16b 100644 --- a/app/options/log.cue +++ b/app/options/log.cue @@ -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. diff --git a/app/options/messagebus.cue b/app/options/messagebus.cue index 78b6f89f5..e8f9f0d7f 100644 --- a/app/options/messagebus.cue +++ b/app/options/messagebus.cue @@ -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" } } diff --git a/app/options/monitor.cue b/app/options/monitor.cue index bbef1c8f7..16757bb6f 100644 --- a/app/options/monitor.cue +++ b/app/options/monitor.cue @@ -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" diff --git a/app/options/object_store.cue b/app/options/object_store.cue index e6f7a57ca..ea9c200ee 100644 --- a/app/options/object_store.cue +++ b/app/options/object_store.cue @@ -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" } } } diff --git a/app/options/plugins.cue b/app/options/plugins.cue index ceff1bdf6..52800e546 100644 --- a/app/options/plugins.cue +++ b/app/options/plugins.cue @@ -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" diff --git a/app/options/provision.cue b/app/options/provision.cue index 8c6e9ea3e..50151b55f 100644 --- a/app/options/provision.cue +++ b/app/options/provision.cue @@ -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" diff --git a/app/options/sentry.cue b/app/options/sentry.cue index 722a4e85e..32df50e24 100644 --- a/app/options/sentry.cue +++ b/app/options/sentry.cue @@ -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." diff --git a/app/options/template.cue b/app/options/template.cue index bcf64b334..a89a4af0e 100644 --- a/app/options/template.cue +++ b/app/options/template.cue @@ -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." } } diff --git a/app/options/upgrade.cue b/app/options/upgrade.cue index ffcdbd9fe..f87a53a27 100644 --- a/app/options/upgrade.cue +++ b/app/options/upgrade.cue @@ -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." } } } diff --git a/app/options/waitFor.cue b/app/options/waitFor.cue index d97c6a9a5..0737c8520 100644 --- a/app/options/waitFor.cue +++ b/app/options/waitFor.cue @@ -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" } } } diff --git a/app/options/websocket.cue b/app/options/websocket.cue index e456bd3d5..48b4453a0 100644 --- a/app/options/websocket.cue +++ b/app/options/websocket.cue @@ -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" } } } diff --git a/app/options/workflow.cue b/app/options/workflow.cue index da24f6957..9cafa7eed 100644 --- a/app/options/workflow.cue +++ b/app/options/workflow.cue @@ -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" diff --git a/codegen/assets/templates/gocode/options/options.go.tpl b/codegen/assets/templates/gocode/options/options.go.tpl index 2dca85869..13c601764 100644 --- a/codegen/assets/templates/gocode/options/options.go.tpl +++ b/codegen/assets/templates/gocode/options/options.go.tpl @@ -27,7 +27,7 @@ type ( func {{ .func }}() (o *{{ .struct }}) { o = &{{ .struct }}{ {{- range .options }} - {{- if .default }} + {{- if or .default }} {{ .expIdent }}: {{ .default }}, {{- end }} {{- end }} diff --git a/codegen/options.cue b/codegen/options.cue index 92e92527f..9ffcbd655 100644 --- a/codegen/options.cue +++ b/codegen/options.cue @@ -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 + "\"" + } + }, + ] + }, ] - } }, ] diff --git a/codegen/schema/options.cue b/codegen/schema/options.cue index 86cae1aeb..342c5c096 100644 --- a/codegen/schema/options.cue +++ b/codegen/schema/options.cue @@ -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 } diff --git a/federation/service/node.go b/federation/service/node.go index 2a6c4f711..5a340e62d 100644 --- a/federation/service/node.go +++ b/federation/service/node.go @@ -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), diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index af42a1b0e..9db06877a 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -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"), diff --git a/pkg/options/HTTPServer.go b/pkg/options/HTTPServer.go index 83185fa66..9905764d2 100644 --- a/pkg/options/HTTPServer.go +++ b/pkg/options/HTTPServer.go @@ -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) diff --git a/pkg/options/options.gen.go b/pkg/options/options.gen.go index 18fc6b95f..4cc476300 100644 --- a/pkg/options/options.gen.go +++ b/pkg/options/options.gen.go @@ -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) diff --git a/pkg/options/options.go b/pkg/options/options.go index 881ec72f0..c531e9777 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -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(), diff --git a/pkg/webapp/serve.go b/pkg/webapp/serve.go index e32bc7d85..2209f07b0 100644 --- a/pkg/webapp/serve.go +++ b/pkg/webapp/serve.go @@ -20,7 +20,7 @@ var ( baseHrefMatcher = regexp.MustCompile(``) ) -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( diff --git a/system/service/role.go b/system/service/role.go index 825052126..f2365bac9 100644 --- a/system/service/role.go +++ b/system/service/role.go @@ -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) { diff --git a/system/service/service.go b/system/service/service.go index ca12f5591..6b0f39f5e 100644 --- a/system/service/service.go +++ b/system/service/service.go @@ -32,7 +32,7 @@ type ( Storage options.ObjectStoreOpt Template options.TemplateOpt Auth options.AuthOpt - RBAC options.RBACOpt + RBAC options.RbacOpt Limit options.LimitOpt }