From 80d9b466ac1ee048d52ea4f436170933c341a01f Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sun, 6 Feb 2022 16:13:42 +0100 Subject: [PATCH] Add support for .env.example generator --- .env.example | 1275 +++++++++++++++-- .../assets/templates/docs/.env.example.tpl | 38 + codegen/options.cue | 47 +- 3 files changed, 1263 insertions(+), 97 deletions(-) create mode 100644 codegen/assets/templates/docs/.env.example.tpl diff --git a/.env.example b/.env.example index 374bcfaec..25e030695 100644 --- a/.env.example +++ b/.env.example @@ -1,103 +1,1186 @@ -# Corteza configuration - -# Note: default docker image without any extra command will -# force :80 via flag and override anything you set here -HTTP_ADDR=:80 - -# SMTP configuration -# For dev environment, run mailhog (`make mailhog.up`), set SMTP_HOST to `localhost:1025` -# and visit localhost:8025. -SMTP_HOST=localhost:1025 -SMTP_USER= -SMTP_PASS= -SMTP_FROM="Corteza" - -# JWT Secret, shared among all services. -# If not set, random value will be set every time you reset the service -#AUTH_JWT_SECRET= - -# JWT expiration (duration, default: '720h', 30 days) -#AUTH_JWT_EXPIRY= - -# Debug level you want to use (anything equal or lower than that will be logged) -# Values: debug, info, warn, error, panic, fatal -LOG_LEVEL=info - -# Timeout for internal HTTP client -HTTP_CLIENT_TIMEOUT=30s - -# Allow usage of insecure hosts (self-signed, expired certificates) -HTTP_CLIENT_TSL_INSECURE=false - -# Log HTTP requests -HTTP_LOG_REQUESTS=true - -# Monitoring log interval -MONITOR_INTERVAL=5min - -# Database to use +############################################################################### +############################################################################### # -# If you are in development environment, -# you can use {version} with database name, that will be replaced with build version -# IE. DB_DSN=corteza:corteza@tcp(localhost:3306)/corteza_{version}?collation=utf8mb4_general_ci -DB_DSN=corteza:corteza@tcp(localhost:3306)/corteza?collation=utf8mb4_general_ci - -# Log database queries? -#DB_LOGGER=false - -# Logging level we want to use (values: debug, info, warn, error, dpanic, panic, fatal) -#LOG_LEVEL=info - -# Enable debug logger (more verbose, -#LOG_DEBUG=false - -######################################################################################################################## -# Storage configuration - -# Local, plain storage path: - -# General all-in-one -#STORAGE_PATH=var/store (defaults to "/var/store") - -# or separate path by service (Docker default values): -#COMPOSE_STORAGE_PATH=/data/compose -#SYSTEM_STORAGE_PATH=/data/system - -# Min.io: -# Storage to minio backend is activated when MINIO_ENDPOINT is set +# This file is auto-generated. # -# If you are in development environemnt and using `make minio.up` for testing, -# your min.io instance is most likely listening on localhost -# (inspect `Makefile` for details) -#MINIO_ENDPOINT=localhost:9000 - -# Access & secret key -# These keys are used by Min.io Docker container as well -#MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE -#MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - -# Per-service buckets (default values) -#COMPOSE_MINIO_BUCKET=compose -#SYSTEM_MINIO_BUCKET=system - -# Strict mode: -# When true, it does not create un-existing buckets -#MINIO_STRICT=false - -####################################################################################################################### - +# Copy it to .env and uncomment set or adjust any options you need. # -# Federation - warning, this is still an experimental feature +# There are three ways how this options are loaded when Corteza starts: +# 1. Environmental variables are always loaded and can not be overrided +# by alternative sources (below) (*) +# 2. If one or more --env-file flag is provided corteza looks in the provided +# locations (either file or directory containing .env) +# 3. Directory where the corteza binary is located is scanned for .env file) # -FEDERATION_ENABLED=false -FEDERATION_HOST=localhost:80 -FEDERATION_LABEL=Federation host 1 +# (*) You can use mechanisms from docker or docker-compose to set or load +# environmental variables as well -# Sync settings - paging and sync delay -FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL=2m -FEDERATION_SYNC_DATA_MONITOR_INTERVAL=60s -FEDERATION_SYNC_DATA_PAGE_SIZE=100 +############################################################################### +############################################################################### +# Connection to data store backend +# -# This needs to be one per page for architectural reasons for now -FEDERATION_SYNC_STRUCTURE_PAGE_SIZE=1 +############################################################################### +# Database connection string. +# Type: string +# Default: sqlite3://file::memory:?cache=shared&mode=memory +# DB_DSN=sqlite3://file::memory:?cache=shared&mode=memory +############################################################################### +############################################################################### +# HTTP Client +# + +############################################################################### +# Allow insecure (invalid, expired TLS/SSL certificates) connections. +# +# [IMPORTANT] +# ==== +# We strongly recommend keeping this value set to false except for local development or demos. +# ==== +# Type: bool +# Default: +# HTTP_CLIENT_TLS_INSECURE= + +############################################################################### +# Default timeout for clients. +# Type: time.Duration +# Default: 30s +# HTTP_CLIENT_TIMEOUT=30s + +############################################################################### +############################################################################### +# HTTP Server +# + +############################################################################### +# IP and port for the HTTP server. +# Type: string +# Default: :80 +# HTTP_ADDR=:80 + +############################################################################### +# Log HTTP requests. +# Type: bool +# Default: +# HTTP_LOG_REQUEST= + +############################################################################### +# Log HTTP responses. +# Type: bool +# Default: +# HTTP_LOG_RESPONSE= + +############################################################################### +# Type: bool +# Default: +# HTTP_ERROR_TRACING= + +############################################################################### +# Type: bool +# Default: +# HTTP_ENABLE_HEALTHCHECK_ROUTE= + +############################################################################### +# Enable `/version` route. +# Type: bool +# Default: +# HTTP_ENABLE_VERSION_ROUTE= + +############################################################################### +# Enable `/debug` route. +# Type: bool +# Default: +# HTTP_ENABLE_DEBUG_ROUTE= + +############################################################################### +# Enable (prometheus) metrics. +# Type: bool +# Default: +# HTTP_METRICS= + +############################################################################### +# Name for metrics endpoint. +# Type: string +# Default: corteza +# HTTP_METRICS_NAME=corteza + +############################################################################### +# Username for the metrics endpoint. +# Type: string +# Default: metrics +# HTTP_METRICS_USERNAME=metrics + +############################################################################### +# Password for the metrics endpoint. +# Type: string +# Default: +# HTTP_METRICS_PASSWORD= + +############################################################################### +# Report HTTP panic to Sentry. +# Type: bool +# Default: +# HTTP_REPORT_PANIC= + +############################################################################### +# Base URL (prefix) for all routes (/auth, /api, ...) +# Type: string +# Default: / +# HTTP_BASE_URL=/ + +############################################################################### +# Type: bool +# Default: +# HTTP_API_ENABLED= + +############################################################################### +# 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 +# Type: string +# Default: / +# HTTP_API_BASE_URL=/ + +############################################################################### +# Type: bool +# Default: +# HTTP_WEBAPP_ENABLED= + +############################################################################### +# Webapp base URL is internaly prefixed with baseUrl +# Type: string +# Default: / +# HTTP_WEBAPP_BASE_URL=/ + +############################################################################### +# Type: string +# Default: ./webapp/public +# HTTP_WEBAPP_BASE_DIR=./webapp/public + +############################################################################### +# Type: string +# Default: admin,compose,workflow,reporter +# HTTP_WEBAPP_LIST=admin,compose,workflow,reporter + +############################################################################### +# Is SSL termination enabled in ingres, proxy or load balancer that is in front of Corteza? +# By default, Corteza checks for presence of LETSENCRYPT_HOST environmental variable. +# This DOES NOT enable SSL termination in Cortreza! +# Type: bool +# Default: +# HTTP_SSL_TERMINATED= + +############################################################################### +############################################################################### +# RBAC options +# + +############################################################################### +# Log RBAC related events and actions +# Type: bool +# Default: +# RBAC_LOG= + +############################################################################### +# Type: string +# Default: +# RBAC_SERVICE_USER= + +############################################################################### +# Space delimited list of role handles. +# These roles causes short-circuiting access control check and allowing all operations. +# System will refuse to start if check-bypassing roles are also listed as authenticated or anonymous auto-assigned roles. +# Type: string +# Default: super-admin +# RBAC_BYPASS_ROLES=super-admin + +############################################################################### +# Space delimited list of role handles. +# These roles are automatically assigned to authenticated user. +# Memberships can not be managed for these roles. +# System will refuse to start if roles listed here are also listed under anonymous roles +# Type: string +# Default: authenticated +# RBAC_AUTHENTICATED_ROLES=authenticated + +############################################################################### +# Space delimited list of role handles. +# These roles are automatically assigned to anonymous user. +# Memberships can not be managed for these roles. +# Type: string +# Default: anonymous +# RBAC_ANONYMOUS_ROLES=anonymous + +############################################################################### +############################################################################### +# SCIM Server +# + +############################################################################### +# Enable SCIM subsystem +# Type: bool +# Default: +# SCIM_ENABLED= + +############################################################################### +# Prefix for SCIM API endpoints +# Type: string +# Default: /scim +# SCIM_BASE_URL=/scim + +############################################################################### +# Secret to use to validate requests on SCIM API endpoints +# Type: string +# Default: +# SCIM_SECRET= + +############################################################################### +# Use external IDs in SCIM API endpoints +# Type: bool +# Default: +# SCIM_EXTERNAL_ID_AS_PRIMARY= + +############################################################################### +# Validates format of external IDs. Defaults to UUID +# Type: string +# 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}$ +# SCIM_EXTERNAL_ID_VALIDATION=^[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}$ + +############################################################################### +############################################################################### +# Email sending +# +# Configure your local SMTP server or use one of the available providers. +# +# These values are copied to settings when the server starts and can be managed from the administration console. +# We recommend you remove these values after they are copied to settings. +# If server detects difference between these options and settings, it shows a warning in the log on server start. +# + + +############################################################################### +# The SMTP server hostname. +# Type: string +# Default: localhost +# SMPT_HOST=localhost + +############################################################################### +# The SMTP post. +# Type: int +# Default: +# SMPT_PORT= + +############################################################################### +# The SMTP username. +# Type: string +# Default: +# SMPT_USER= + +############################################################################### +# The SMTP password. +# Type: string +# Default: +# SMPT_PASS= + +############################################################################### +# The SMTP `from` email parameter +# Type: string +# Default: +# SMPT_FROM= + +############################################################################### +# Allow insecure (invalid, expired TLS certificates) connections. +# Type: bool +# Default: +# SMPT_TLS_INSECURE= + +############################################################################### +# Type: string +# Default: +# SMPT_TLS_SERVER_NAME= + +############################################################################### +############################################################################### +# Actionlog +# + +############################################################################### +# Type: bool +# Default: +# ACTIONLOG_ENABLED= + +############################################################################### +# Type: bool +# Default: +# ACTIONLOG_DEBUG= + +############################################################################### +# Type: bool +# Default: +# ACTIONLOG_WORKFLOW_FUNCTIONS_ENABLED= + +############################################################################### +############################################################################### +# API Gateway +# + +############################################################################### +# Enable API Gateway +# Type: bool +# Default: +# APIGW_ENABLED= + +############################################################################### +# Enable API Gateway debugging info +# Type: bool +# Default: +# APIGW_DEBUG= + +############################################################################### +# Enable extra logging +# Type: bool +# Default: +# APIGW_LOG_ENABLED= + +############################################################################### +# Enable incoming request body output in logs +# Type: bool +# Default: +# APIGW_LOG_REQUEST_BODY= + +############################################################################### +# Enable full debug log on requests / responses - warning, includes sensitive data +# Type: bool +# Default: +# APIGW_PROXY_ENABLE_DEBUG_LOG= + +############################################################################### +# Follow redirects on proxy requests +# Type: bool +# Default: +# APIGW_PROXY_FOLLOW_REDIRECTS= + +############################################################################### +# Outbound request timeout +# Type: time.Duration +# Default: 30s +# APIGW_PROXY_OUTBOUND_TIMEOUT=30s + +############################################################################### +############################################################################### +# Authentication +# + +############################################################################### +# Enable extra logging for authentication flows +# Type: bool +# Default: +# AUTH_LOG_ENABLED= + +############################################################################### +# Password security allows you to disable constraints to which passwords must conform to. +# +# [CAUTION] +# ==== +# Disabling password security can be useful for development environments as it removes the need for complex passwords. +# Password security *should be enabled* on production environments to avoid security incidents +# ==== +# Type: bool +# Default: +# AUTH_PASSWORD_SECURITY= + +############################################################################### +# Secret used for signing JWT tokens. +# +# [IMPORTANT] +# ==== +# If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables. +# Generated secret will change if you change any of these variables. +# ==== +# Type: string +# Default: +# AUTH_JWT_SECRET= + +############################################################################### +# Access token lifetime +# Type: time.Duration +# Default: 2h +# AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME=2h + +############################################################################### +# Refresh token lifetime +# Type: time.Duration +# Default: 72h +# AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME=72h + +############################################################################### +# Expiration time for the auth JWT tokens. +# Type: time.Duration +# Default: 720h +# AUTH_JWT_EXPIRY=720h + +############################################################################### +# Redirect URL to be sent with OAuth2 authentication request to provider +# +# `provider` placeholder is replaced with the actual value when used. +# Type: string +# Default: +# AUTH_EXTERNAL_REDIRECT_URL= + +############################################################################### +# Secret used for securing cookies +# +# [IMPORTANT] +# ==== +# If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables. +# Generated secret will change if you change any of these variables. +# ==== +# Type: string +# Default: +# AUTH_EXTERNAL_COOKIE_SECRET= + +############################################################################### +# Frontend base URL. Must be an absolute URL, with the domain. +# This is used for some redirects and links in auth emails. +# Type: string +# Default: +# AUTH_BASE_URL= + +############################################################################### +# Session cookie name +# Type: string +# Default: session +# AUTH_SESSION_COOKIE_NAME=session + +############################################################################### +# Session cookie path +# Type: string +# Default: +# AUTH_SESSION_COOKIE_PATH= + +############################################################################### +# Session cookie domain +# Type: string +# Default: +# AUTH_SESSION_COOKIE_DOMAIN= + +############################################################################### +# Defaults to true when HTTPS is used. Corteza will try to guess the this setting by +# Type: bool +# Default: +# AUTH_SESSION_COOKIE_SECURE= + +############################################################################### +# How long do we keep the temporary session +# Type: time.Duration +# Default: 24h +# AUTH_SESSION_LIFETIME=24h + +############################################################################### +# How long do we keep the permanent session +# Type: time.Duration +# Default: 8640h +# AUTH_SESSION_PERM_LIFETIME=8640h + +############################################################################### +# How often are expired sessions and tokens purged from the database +# Type: time.Duration +# Default: 15min +# AUTH_GARBAGE_COLLECTOR_INTERVAL=15min + +############################################################################### +# How many requests from a cerain IP address are allowed in a time window. +# Set to zero to disable +# Type: int +# Default: 60 +# AUTH_REQUEST_RATE_LIMIT=60 + +############################################################################### +# How many requests from a cerain IP address are allowed in a time window +# Type: time.Duration +# Default: 1m +# AUTH_REQUEST_RATE_WINDOW_LENGTH=1m + +############################################################################### +# Secret used for securing CSRF protection +# +# [IMPORTANT] +# ==== +# If secret is not set, system auto-generates one from DB_DSN and HOSTNAME environment variables. +# Generated secret will change if you change any of these variables. +# ==== +# Type: string +# Default: +# AUTH_CSRF_SECRET= + +############################################################################### +# Enable CSRF protection +# Type: bool +# Default: +# AUTH_CSRF_ENABLED= + +############################################################################### +# Form field name used for CSRF protection +# Type: string +# Default: same-site-authenticity-token +# AUTH_CSRF_FIELD_NAME=same-site-authenticity-token + +############################################################################### +# Cookie name used for CSRF protection +# Type: string +# Default: same-site-authenticity-token +# AUTH_CSRF_COOKIE_NAME=same-site-authenticity-token + +############################################################################### +# Handle for OAuth2 client used for automatic redirect from /auth/oauth2/go endpoint. +# +# This simplifies configuration for OAuth2 flow for Corteza Web applications as it removes +# the need to suply redirection URL and client ID (oauth2/go endpoint does that internally) +# +# Type: string +# Default: corteza-webapp +# AUTH_DEFAULT_CLIENT=corteza-webapp + +############################################################################### +# Path to js, css, images and template source files +# +# When corteza starts, if path exists it tries to load template files from it. +# If not it uses statically embedded files. +# +# When empty path is set (default value), embedded files are used. +# Type: string +# Default: +# AUTH_ASSETS_PATH= + +############################################################################### +# When enabled, corteza reloads template before every execution. +# Enable this for debugging or when developing auth templates. +# +# Should be disabled in production where templates do not change between server restarts. +# Type: bool +# Default: +# AUTH_DEVELOPMENT_MODE= + +############################################################################### +############################################################################### +# Connection to Corredor +# + +############################################################################### +# Enable/disable Corredor integration +# Type: bool +# Default: +# CORREDOR_ENABLED= + +############################################################################### +# Hostname and port of the Corredor gRPC server. +# Type: string +# Default: localhost:50051 +# CORREDOR_ADDR=localhost:50051 + +############################################################################### +# Max delay for backoff on connection. +# Type: time.Duration +# Default: 1m +# CORREDOR_MAX_BACKOFF_DELAY=1m + +############################################################################### +# Max message size that can be recived. +# Type: int +# Default: +# CORREDOR_MAX_RECEIVE_MESSAGE_SIZE= + +############################################################################### +# Type: time.Duration +# Default: +# CORREDOR_DEFAULT_EXEC_TIMEOUT= + +############################################################################### +# Type: time.Duration +# Default: 2s +# CORREDOR_LIST_TIMEOUT=2s + +############################################################################### +# Type: time.Duration +# Default: +# CORREDOR_LIST_REFRESH= + +############################################################################### +# Type: bool +# Default: +# CORREDOR_RUN_AS_ENABLED= + +############################################################################### +# Type: bool +# Default: +# CORREDOR_CLIENT_CERTIFICATES_ENABLED= + +############################################################################### +# Type: string +# Default: /certs/corredor/client +# CORREDOR_CLIENT_CERTIFICATES_PATH=/certs/corredor/client + +############################################################################### +# Type: string +# Default: ca.crt +# CORREDOR_CLIENT_CERTIFICATES_CA=ca.crt + +############################################################################### +# Type: string +# Default: private.key +# CORREDOR_CLIENT_CERTIFICATES_PRIVATE=private.key + +############################################################################### +# Type: string +# Default: public.crt +# CORREDOR_CLIENT_CERTIFICATES_PUBLIC=public.crt + +############################################################################### +# Type: string +# Default: +# CORREDOR_CLIENT_CERTIFICATES_SERVER_NAME= + +############################################################################### +############################################################################### +# Environment +# + +############################################################################### +# Type: string +# Default: production +# ENVIRONMENT=production + +############################################################################### +############################################################################### +# Events and scheduler +# + +############################################################################### +# Enable eventbus scheduler. +# Type: bool +# Default: +# EVENTBUS_SCHEDULER_ENABLED= + +############################################################################### +# Set time interval for `eventbus` scheduler. +# Type: time.Duration +# Default: 60s +# EVENTBUS_SCHEDULER_INTERVAL=60s + +############################################################################### +############################################################################### +# federation +# + +############################################################################### +# Federation enabled on system, it toggles rest API endpoints, possibility to map modules in Compose and sync itself +# Type: bool +# Default: +# FEDERATION_ENABLED= + +############################################################################### +# Federation label +# Type: string +# Default: federated +# FEDERATION_LABEL=federated + +############################################################################### +# Host that is used during node pairing, also included in invitation +# Type: string +# Default: local.cortezaproject.org +# FEDERATION_HOST=local.cortezaproject.org + +############################################################################### +# Delay in seconds for structure sync +# Type: time.Duration +# Default: 2m +# FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL=2m + +############################################################################### +# Bulk size in fetching for structure sync +# Type: int +# Default: 1 +# FEDERATION_SYNC_STRUCTURE_PAGE_SIZE=1 + +############################################################################### +# Delay in seconds for data sync +# Type: time.Duration +# Default: 1m +# FEDERATION_SYNC_DATA_MONITOR_INTERVAL=1m + +############################################################################### +# Bulk size in fetching for data sync +# Type: int +# Default: 100 +# FEDERATION_SYNC_DATA_PAGE_SIZE=100 + +############################################################################### +############################################################################### +# Limits +# + +############################################################################### +# Maximum number of valid (not deleted, not suspended) users +# Type: int +# Default: +# LIMIT_SYSTEM_USERS= + +############################################################################### +############################################################################### +# locale +# + +############################################################################### +# List of compa delimited languages (language tags) to enable. +# In case when an enabled language can not be loaded, error is logged. +# +# When loading language configurations (config.xml) from the configured path(s). +# +# Type: string +# Default: en +# LOCALE_LANGUAGES=en + +############################################################################### +# One or more paths to locale config and translation files, separated by colon +# Type: string +# Default: +# LOCALE_PATH= + +############################################################################### +# Name of the query string parameter used to pass the language tag (it overrides Accept-Language header). +# Set it to empty string to disable detection from the query string. +# This parameter is ignored if only one language is enabled +# +# Type: string +# Default: lng +# LOCALE_QUERY_STRING_PARAM=lng + +############################################################################### +# When enabled, Corteza all +# Type: bool +# Default: +# LOCALE_RESOURCE_TRANSLATIONS_ENABLED= + +############################################################################### +# Log locale related events and actions +# Type: bool +# Default: +# LOCALE_LOG= + +############################################################################### +# When enabled, Corteza reloads language files on every request +# Enable this for debugging or developing. +# Type: bool +# Default: +# LOCALE_DEVELOPMENT_MODE= + +############################################################################### +############################################################################### +# log +# + +############################################################################### +# Disables JSON format for logging and enables more human-readable output with colors. +# +# Disable for production. +# +# Type: bool +# Default: +# LOG_DEBUG= + +############################################################################### +# Minimum logging level. If set to "warn", +# Levels warn, error, dpanic panic and fatal will be logged. +# +# Recommended value for production: warn +# +# Possible values: debug, info, warn, error, dpanic, panic, fatal +# +# Type: string +# Default: warn +# LOG_LEVEL=warn + +############################################################################### +# Log filtering rules by level and name (log-level:log-namespace). +# Please note that level (LOG_LEVEL) is applied before filter and it affects the final output! +# +# Leave unset for production. +# +# Example: +# `warn+:* *:auth,workflow.*` +# Log warnings, errors, panic, fatals. Everything from auth and workflow is logged. +# +# +# See more examples and documentation here: https://github.com/moul/zapfilter +# +# Type: string +# Default: +# LOG_FILTER= + +############################################################################### +# Set to true to see where the logging was called from. +# +# Disable for production. +# +# Type: bool +# Default: +# LOG_INCLUDE_CALLER= + +############################################################################### +# Include stack-trace when logging at a specified level or below. +# Disable for production. +# +# Possible values: debug, info, warn, error, dpanic, panic, fatal +# +# Type: string +# Default: dpanic +# LOG_STACKTRACE_LEVEL=dpanic + +############################################################################### +############################################################################### +# Messaging queue +# + +############################################################################### +# Enable messagebus +# Type: bool +# Default: +# MESSAGEBUS_ENABLED= + +############################################################################### +# Enable extra logging for messagebus watchers +# Type: bool +# Default: +# MESSAGEBUS_LOG_ENABLED= + +############################################################################### +############################################################################### +# Monitoring +# + +############################################################################### +# Output (log) interval for monitoring. +# Type: time.Duration +# Default: 5m +# MONITOR_INTERVAL=5m + +############################################################################### +############################################################################### +# Object (file) storage +# +# The MinIO integration allows you to replace local storage with cloud storage. When configured, `STORAGE_PATH` is not needed. +# + + +############################################################################### +# Location where uploaded files are stored. +# Type: string +# Default: var/store +# STORAGE_PATH=var/store + +############################################################################### +# Type: string +# Default: +# MINIO_ENDPOINT= + +############################################################################### +# Type: bool +# Default: +# MINIO_SECURE= + +############################################################################### +# Type: string +# Default: +# MINIO_ACCESS_KEY= + +############################################################################### +# Type: string +# Default: +# MINIO_SECRET_KEY= + +############################################################################### +# Type: string +# Default: +# MINIO_SSEC_KEY= + +############################################################################### +# `component` placeholder is replaced with service name (e.g system). +# Type: string +# Default: {component} +# MINIO_BUCKET={component} + +############################################################################### +# `component` placeholder is replaced with service name (e.g system). +# Type: string +# Default: +# MINIO_PATH_PREFIX= + +############################################################################### +# Type: bool +# Default: +# MINIO_STRICT= + +############################################################################### +############################################################################### +# Plugins +# + +############################################################################### +# Enable plugins +# Type: bool +# Default: +# PLUGINS_ENABLED= + +############################################################################### +# List of colon seperated paths or patterns where plugins could be found +# Type: string +# Default: +# PLUGINS_PATHS= + +############################################################################### +############################################################################### +# Provisioning +# +# Provisioning allows you to configure a {PRODUCT_NAME} instance when deployed. +# It occurs automatically after the {PRODUCT_NAME} server starts. +# +# [IMPORTANT] +# ==== +# We recommend you to keep provisioning enabled as it simplifies version updates by updating the database and updating settings. +# +# If you're doing local development or some debugging, you can disable this. +# ==== +# + + +############################################################################### +# Controls if provision should run when the server starts. +# Type: bool +# Default: +# PROVISION_ALWAYS= + +############################################################################### +# Colon seperated paths to config files for provisioning. +# Type: string +# Default: provision/* +# PROVISION_PATH=provision/* + +############################################################################### +############################################################################### +# Seeder +# + +############################################################################### +# Enable extra logging // fixme add some more description +# Type: bool +# Default: +# SEEDER_LOG_ENABLED= + +############################################################################### +############################################################################### +# Sentry monitoring +# +# [NOTE] +# ==== +# These parameters help in the development and testing process. +# When you are deploying to production, these should be disabled to improve performance and reduce storage usage. +# +# You should configure external services such as Sentry or ELK to keep track of logs and error reports. +# ==== +# + + +############################################################################### +# Set to enable Sentry client. +# Type: string +# Default: +# SENTRY_DSN= + +############################################################################### +# Print out debugging information. +# Type: bool +# Default: +# SENTRY_DEBUG= + +############################################################################### +# Attach stacktraces +# Type: bool +# Default: +# SENTRY_ATTACH_STACKTRACE= + +############################################################################### +# Sample rate for event submission (0.0 - 1.0. defaults to 1.0) +# Type: float64 +# Default: +# SENTRY_SAMPLE_RATE= + +############################################################################### +# Maximum number of bredcrumbs. +# Type: int +# Default: +# SENTRY_MAX_BREADCRUMBS= + +############################################################################### +# Set reported Server name. +# Type: string +# Default: +# SENTRY_SERVERNAME= + +############################################################################### +# Set reported Release. +# Type: string +# Default: +# SENTRY_RELEASE= + +############################################################################### +# Set reported distribution. +# Type: string +# Default: +# SENTRY_DIST= + +############################################################################### +# Set reported environment. +# Type: string +# Default: +# SENTRY_ENVIRONMENT= + +############################################################################### +############################################################################### +# Rendering engine +# + +############################################################################### +# Gotenberg rendering container address. +# Type: string +# Default: +# TEMPLATE_RENDERER_GOTENBERG_ADDRESS= + +############################################################################### +# Is Gotenberg rendering container enabled. +# Type: bool +# Default: +# TEMPLATE_RENDERER_GOTENBERG_ENABLED= + +############################################################################### +############################################################################### +# Data store (database) upgrade +# + +############################################################################### +# Enable/disable debug logging. +# To enable debug logging set `UPGRADE_DEBUG=true`. +# Type: bool +# Default: +# UPGRADE_DEBUG= + +############################################################################### +# Controls if the upgradable systems should be upgraded when the server starts. +# Type: bool +# Default: +# UPGRADE_ALWAYS= + +############################################################################### +############################################################################### +# Delay system startup +# +# You can configure these options to defer API execution until another external (HTTP) service is up and running. +# +# [ TIP ] +# ==== +# Delaying API execution can come in handy in complex setups where execution order is important. +# ==== +# + + +############################################################################### +# Delays API startup for the amount of time specified (10s, 2m...). +# This delay happens before service (`WAIT_FOR_SERVICES`) probing. +# Type: time.Duration +# Default: +# WAIT_FOR= + +############################################################################### +# Show temporary status web page. +# Type: bool +# Default: +# WAIT_FOR_STATUS_PAGE= + +############################################################################### +# Space delimited list of hosts and/or URLs to probe. +# Host format: `host` or `host:443` (port will default to 80). +# +# [NOTE] +# ==== +# Services are probed in parallel. +# ==== +# Type: string +# Default: +# WAIT_FOR_SERVICES= + +############################################################################### +# Max time for each service probe. +# Type: time.Duration +# Default: 1m +# WAIT_FOR_SERVICES_TIMEOUT=1m + +############################################################################### +# Timeout for each service probe. +# Type: time.Duration +# Default: 30s +# WAIT_FOR_SERVICES_PROBE_TIMEOUT=30s + +############################################################################### +# Interval between service probes. +# Type: time.Duration +# Default: 5s +# WAIT_FOR_SERVICES_PROBE_INTERVAL=5s + +############################################################################### +############################################################################### +# Websocket server +# + +############################################################################### +# Enable extra logging for authentication flows +# Type: bool +# Default: +# WEBSOCKET_LOG_ENABLED= + +############################################################################### +# Time before `WsServer` gets timed out. +# Type: time.Duration +# Default: 15s +# WEBSOCKET_TIMEOUT=15s + +############################################################################### +# Type: time.Duration +# Default: 120s +# WEBSOCKET_PING_TIMEOUT=120s + +############################################################################### +# Type: time.Duration +# Default: 119s +# WEBSOCKET_PING_PERIOD=119s + +############################################################################### +############################################################################### +# Workflow +# + +############################################################################### +# Registers enabled and valid workflows and executes them when triggered +# Type: bool +# Default: +# WORKFLOW_REGISTER= + +############################################################################### +# Enables verbose logging for workflow execution +# Type: bool +# Default: +# WORKFLOW_EXEC_DEBUG= + +############################################################################### +# Defines the maximum call stack size between workflows +# Type: int +# Default: +# WORKFLOW_CALL_STACK_SIZE= diff --git a/codegen/assets/templates/docs/.env.example.tpl b/codegen/assets/templates/docs/.env.example.tpl new file mode 100644 index 000000000..d31816b69 --- /dev/null +++ b/codegen/assets/templates/docs/.env.example.tpl @@ -0,0 +1,38 @@ +############################################################################### +############################################################################### +# +# This file is auto-generated. +# +# Copy it to .env and uncomment set or adjust any options you need. +# +# There are three ways how this options are loaded when Corteza starts: +# 1. Environmental variables are always loaded and can not be overrided +# by alternative sources (below) (*) +# 2. If one or more --env-file flag is provided corteza looks in the provided +# locations (either file or directory containing .env) +# 3. Directory where the corteza binary is located is scanned for .env file) +# +# (*) You can use mechanisms from docker or docker-compose to set or load +# environmental variables as well +{{- range .groups }} + +############################################################################### +############################################################################### +{{ .title }} +# +{{- if .intro }} +{{ .intro }} +# +{{ end -}} + +{{ range .options }} + +############################################################################### +{{- if .description }} +{{ .description }} +{{- end }} +# Type: {{ .type }} +# Default: {{ .defaultValue }} +# {{ .env }}={{ .defaultValue }} +{{- end }} +{{- end }} diff --git a/codegen/options.cue b/codegen/options.cue index 9ffcbd655..e9fda9508 100644 --- a/codegen/options.cue +++ b/codegen/options.cue @@ -1,6 +1,7 @@ package codegen import ( + "strings" "github.com/cortezaproject/corteza-server/app" "github.com/cortezaproject/corteza-server/codegen/schema" ) @@ -50,4 +51,48 @@ options: ] } }, - ] + ]+ + + [ + { + template: "docs/.env.example.tpl" + output: ".env.example" + syntax: ".env" + payload: { + groups: [ + for g in app.corteza.options { + title: "# " + strings.Join(strings.Split(g.title, "\n"), "\n# ") + + if (g.intro != _|_) { + intro: "# " + strings.Join(strings.Split(g.intro, "\n"), "\n# ") + } + + options: [ + for o in g.options { + handle: o.handle + env: o.env + type: o.type + + defaultGoExpr?: string + if (o.defaultGoExpr != _|_) { + defaultGoExpr: o.defaultGoExpr + } + + defaultValue?: string + if (o.defaultValue != _|_) { + defaultValue: o.defaultValue + } + + if (o.description != _|_) { + description: "# " + strings.Join(strings.Split(o.description, "\n"), "\n# ") + } + }, + ] + }, + ] + } + }, + ]+ + + // placeholder + []