Documentation
¶
Index ¶
Constants ¶
const DefaultGatewayStorageBudget = 1 << 30
DefaultGatewayStorageBudget bounds the database on a gateway unless storage_budget is set; a negative budget is unlimited (LONG-07).
Variables ¶
This section is empty.
Functions ¶
func DefaultNamespaces ¶
DefaultNamespaces reproduce today's behavior of processes and smart services (NS-02, NS-03, NS-05, NS-06): process models are shareable, deployments and instances of processes belong to their owner; smart service designs belong to their owner, releases and instances are shareable.
Types ¶
type Config ¶
type Config struct {
ServerPort int `json:"server_port" env_var:"SERVER_PORT"`
LogLevel string `json:"log_level" env_var:"LOG_LEVEL"`
// "postgres" or "sqlite"
Database string `json:"database" env_var:"DATABASE"`
PostgresDsn types.Secret `json:"postgres_dsn" env_var:"POSTGRES_DSN"`
// open connections per process, 0 for no limit; behind PgBouncer in session mode every open
// connection holds a server connection of the pool
PostgresMaxConns int `json:"postgres_max_conns" env_var:"POSTGRES_MAX_CONNS"`
SqlitePath string `json:"sqlite_path" env_var:"SQLITE_PATH"`
// with a certificate URL, token signatures are verified; otherwise Kong has verified them (SEC-04)
// e.g. https://<keycloak>/auth/realms/<realm>/protocol/openid-connect/certs
KeycloakCertUrl string `json:"keycloak_cert_url" env_var:"KEYCLOAK_CERT_URL"`
// time zone for timers; empty uses the local zone of the process (TZ)
Timezone string `json:"timezone" env_var:"TIMEZONE"`
MaxTokens int `json:"max_tokens" env_var:"MAX_TOKENS"`
MaxVariableBytes int `json:"max_variable_bytes" env_var:"MAX_VARIABLE_BYTES"`
MaxInstanceVariablesBytes int `json:"max_instance_variables_bytes" env_var:"MAX_INSTANCE_VARIABLES_BYTES"`
MaxActivities int `json:"max_activities" env_var:"MAX_ACTIVITIES"`
ScriptTimeout string `json:"script_timeout" env_var:"SCRIPT_TIMEOUT"`
// shortest timer duration of a model, as process-deployment had it; "0s" allows every one
MinTimerDuration string `json:"min_timer_duration" env_var:"MIN_TIMER_DURATION"`
TaskTimeout string `json:"task_timeout" env_var:"TASK_TIMEOUT"`
TaskRetries int `json:"task_retries" env_var:"TASK_RETRIES"`
PollInterval string `json:"poll_interval" env_var:"POLL_INTERVAL"`
RetentionDefaultDays int `json:"retention_default_days" env_var:"RETENTION_DEFAULT_DAYS"`
// 0: no global maximum
RetentionMaxDays int `json:"retention_max_days" env_var:"RETENTION_MAX_DAYS"`
ModelVersionsKept int `json:"model_versions_kept" env_var:"MODEL_VERSIONS_KEPT"`
// empty: no permissions-v2, only owners and admins have access
PermissionsV2Url string `json:"permissions_v2_url" env_var:"PERMISSIONS_V2_URL"`
// Keycloak base URL and client for internal calls with client credentials (SEC-03)
AuthEndpoint string `json:"auth_endpoint" env_var:"AUTH_ENDPOINT"`
AuthClientId string `json:"auth_client_id" env_var:"AUTH_CLIENT_ID"`
AuthClientSecret types.Secret `json:"auth_client_secret" env_var:"AUTH_CLIENT_SECRET"`
// empty disables the target (INC-02)
NotifierUrl string `json:"notifier_url" env_var:"NOTIFIER_URL"`
DeveloperNotificationsUrl string `json:"developer_notifications_url" env_var:"DEVELOPER_NOTIFICATIONS_URL"`
// internal port, not routed through Kong: Prometheus metrics (OPS-05) and the HTTP answers
// of protocol handlers (POST /responses, POST /errors, TASK-05); 0 disables
InternalPort int `json:"internal_port" env_var:"INTERNAL_PORT"`
// running instances without element change for this long count as stalled (LONG-13)
StalledAfter string `json:"stalled_after" env_var:"STALLED_AFTER"`
// OTLP collector over gRPC for traces; empty selects the platform default of
// gin-middleware/otelx, "off" disables tracing
OtelEndpoint string `json:"otel_endpoint" env_var:"OTEL_ENDPOINT"`
// services and options of the module task types of smart services (TASK-29)
DeviceManagerUrl string `json:"device_manager_url" env_var:"DEVICE_MANAGER_URL"`
FlowEngineUrl string `json:"flow_engine_url" env_var:"FLOW_ENGINE_URL"`
// analytics-flow-repo; flows used by deployments are checked for changes (SMS-15)
FlowRepoUrl string `json:"flow_repo_url" env_var:"FLOW_REPO_URL"`
// how often the resources deployments use are checked for changes; "off" or "0" switches it off
ResourceCheckCycle string `json:"resource_check_cycle" env_var:"RESOURCE_CHECK_CYCLE"`
FlowParserUrl string `json:"flow_parser_url" env_var:"FLOW_PARSER_URL"`
ServingServiceUrl string `json:"serving_service_url" env_var:"SERVING_SERVICE_URL"`
AnalyticsEnableMultiplePaths bool `json:"analytics_enable_multiple_paths" env_var:"ANALYTICS_ENABLE_MULTIPLE_PATHS"`
AnalyticsDevicePathPrefix string `json:"analytics_device_path_prefix" env_var:"ANALYTICS_DEVICE_PATH_PREFIX"`
AnalyticsGroupPathPrefix string `json:"analytics_group_path_prefix" env_var:"ANALYTICS_GROUP_PATH_PREFIX"`
AnalyticsImportPathPrefix string `json:"analytics_import_path_prefix" env_var:"ANALYTICS_IMPORT_PATH_PREFIX"`
AnalyticsRemoveImportPathRoot bool `json:"analytics_remove_import_path_root" env_var:"ANALYTICS_REMOVE_IMPORT_PATH_ROOT"`
DeviceGroupNamePrefix string `json:"device_group_name_prefix" env_var:"DEVICE_GROUP_NAME_PREFIX"`
DeviceGroupAttributeOrigin string `json:"device_group_attribute_origin" env_var:"DEVICE_GROUP_ATTRIBUTE_ORIGIN"`
InfoAdditionalModuleDataFields bool `json:"info_additional_module_data_fields" env_var:"INFO_ADDITIONAL_MODULE_DATA_FIELDS"`
// watcher task type (TASK-27): requests from models besides device criteria, and intervals
AllowGenericWatchRequests bool `json:"allow_generic_watch_requests" env_var:"ALLOW_GENERIC_WATCH_REQUESTS"`
WatcherMinInterval string `json:"watcher_min_interval" env_var:"WATCHER_MIN_INTERVAL"`
WatcherDefaultInterval string `json:"watcher_default_interval" env_var:"WATCHER_DEFAULT_INTERVAL"`
// interval of the health checks of modules (SMS-11)
ModuleHealthCheckInterval string `json:"module_health_check_interval" env_var:"MODULE_HEALTH_CHECK_INTERVAL"`
// live debug streams per user and replica (DBG-10)
MaxLiveConnectionsPerUser int `json:"max_live_connections_per_user" env_var:"MAX_LIVE_CONNECTIONS_PER_USER"`
// CORS headers for browser applications that call the engine directly; in the platform Kong
// sets them. Comma separated origins such as https://ui.example.org, "*" for every origin;
// empty sets no CORS headers.
CorsAllowedOrigins string `json:"cors_allowed_origins" env_var:"CORS_ALLOWED_ORIGINS"`
// comma separated request headers a browser may send to an allowed origin
CorsAllowedHeaders string `json:"cors_allowed_headers" env_var:"CORS_ALLOWED_HEADERS"`
// Kafka for device commands, their answers and cache invalidation; empty disables Kafka
KafkaUrl string `json:"kafka_url" env_var:"KAFKA_URL"`
KafkaConsumerGroup string `json:"kafka_consumer_group" env_var:"KAFKA_CONSUMER_GROUP"`
ResponseTopic string `json:"response_topic" env_var:"RESPONSE_TOPIC"`
ErrorTopic string `json:"error_topic" env_var:"ERROR_TOPIC"`
// written into each command; the handlers answer there
MetadataResponseTo string `json:"metadata_response_to" env_var:"METADATA_RESPONSE_TO"`
MetadataErrorTo string `json:"metadata_error_to" env_var:"METADATA_ERROR_TO"`
// any message on these topics clears the device cache; devices and device groups clear their entry
CacheInvalidationAllTopics []string `json:"cache_invalidation_all_topics" env_var:"CACHE_INVALIDATION_ALL_TOPICS"`
DeviceTopic string `json:"device_topic" env_var:"DEVICE_TOPIC"`
DeviceGroupTopic string `json:"device_group_topic" env_var:"DEVICE_GROUP_TOPIC"`
// device commands are available when device-repository and marshaller are configured (TASK-01)
DeviceRepositoryUrl string `json:"device_repository_url" env_var:"DEVICE_REPOSITORY_URL"`
MarshallerUrl string `json:"marshaller_url" env_var:"MARSHALLER_URL"`
// empty: services that only send events cannot be read (TASK-08)
TimescaleWrapperUrl string `json:"timescale_wrapper_url" env_var:"TIMESCALE_WRAPPER_URL"`
DeviceSelectionUrl string `json:"device_selection_url" env_var:"DEVICE_SELECTION_URL"`
ImportDeployUrl string `json:"import_deploy_url" env_var:"IMPORT_DEPLOY_URL"`
// what device-selection offers in deploy dialogs, as in process-deployment (DEP-01)
DeviceGroupsForTasks bool `json:"device_groups_for_tasks" env_var:"DEVICE_GROUPS_FOR_TASKS"`
DeviceGroupsForEvents bool `json:"device_groups_for_events" env_var:"DEVICE_GROUPS_FOR_EVENTS"`
ImportsForEvents bool `json:"imports_for_events" env_var:"IMPORTS_FOR_EVENTS"`
ModifiedDevices bool `json:"modified_devices" env_var:"MODIFIED_DEVICES"`
// parallel, sequential or round_robin for device groups (TASK-06)
GroupScheduler string `json:"group_scheduler" env_var:"GROUP_SCHEDULER"`
DeviceCacheTimeout string `json:"device_cache_timeout" env_var:"DEVICE_CACHE_TIMEOUT"`
// engine or event: the event role evaluates device data and correlates events (section 10)
Role string `json:"role" env_var:"ROLE"`
// consumer group of event workers, which share the device data topics
EventConsumerGroup string `json:"event_consumer_group" env_var:"EVENT_CONSUMER_GROUP"`
ImportRepositoryUrl string `json:"import_repository_url" env_var:"IMPORT_REPOSITORY_URL"`
// user deletions published by user-management, the fallback for users deleted outside of it (SEC-14)
UserTopic string `json:"user_topic" env_var:"USER_TOPIC"`
// permissions-v2 publishes rights changes of the engine topics here; the engine restores
// the owner's administrate right (SEC-10); empty disables
PermissionsKafkaTopic string `json:"permissions_kafka_topic" env_var:"PERMISSIONS_KAFKA_TOPIC"`
// cloud or fog; selects the http policy of the namespaces (NS-04) and, in fog, the services
// of the gateway (FOG-01)
Mode string `json:"mode" env_var:"MODE"`
// fog: the broker of the gateway for commands and device events, e.g. tcp://broker:1881
MqttBroker string `json:"mqtt_broker" env_var:"MQTT_BROKER"`
MqttClientId string `json:"mqtt_client_id" env_var:"MQTT_CLIENT_ID"`
MqttUser string `json:"mqtt_user" env_var:"MQTT_USER"`
MqttPassword types.Secret `json:"mqtt_password" env_var:"MQTT_PASSWORD"`
// fog: mgw-last-value, the last values of event services
LastValueUrl string `json:"last_value_url" env_var:"LAST_VALUE_URL"`
// fog: the prefix of the command ids of this engine on the broker of the gateway
LocalCommandPrefix string `json:"local_command_prefix" env_var:"LOCAL_COMMAND_PREFIX"`
// fog: concepts for commands before payload version 3 are refreshed at this interval
ConceptRefreshInterval string `json:"concept_refresh_interval" env_var:"CONCEPT_REFRESH_INTERVAL"`
// cloud: the broker the gateways reach through mgw-device-cloud-connector; empty disables
// deployments to gateways (SYNC-04). Replicas share the messages of the gateways in a group.
SyncMqttBroker string `json:"sync_mqtt_broker" env_var:"SYNC_MQTT_BROKER"`
SyncMqttClientId string `json:"sync_mqtt_client_id" env_var:"SYNC_MQTT_CLIENT_ID"`
SyncMqttUser string `json:"sync_mqtt_user" env_var:"SYNC_MQTT_USER"`
SyncMqttPassword types.Secret `json:"sync_mqtt_password" env_var:"SYNC_MQTT_PASSWORD"`
// unacknowledged desired state goes again after this time (SYNC-08)
SyncResendAfter string `json:"sync_resend_after" env_var:"SYNC_RESEND_AFTER"`
// a gateway without status since this time counts as offline
SyncOfflineAfter string `json:"sync_offline_after" env_var:"SYNC_OFFLINE_AFTER"`
// how long a read of the history of a gateway waits for its answer (DBG-15)
SyncCallTimeout string `json:"sync_call_timeout" env_var:"SYNC_CALL_TIMEOUT"`
// data of a gateway without contact since this time is removed (SYNC-07)
NetworkCleanupMaxAge string `json:"network_cleanup_max_age" env_var:"NETWORK_CLEANUP_MAX_AGE"`
// protocol versions of gateways before the own one the cloud serves (SYNC-11)
SyncProtocolWindow int `json:"sync_protocol_window" env_var:"SYNC_PROTOCOL_WINDOW"`
// upper bound of the database in bytes; 0 is unlimited, in fog 1 GiB, negative unlimited (LONG-07)
StorageBudget int64 `json:"storage_budget" env_var:"STORAGE_BUDGET"`
// fog: the Postgres of process-io-worker of the old process module; its values are taken
// over once at the first start (MIG-06)
LegacyIoPostgres types.Secret `json:"legacy_io_postgres" env_var:"LEGACY_IO_POSTGRES"`
// fog: the owner of the taken over values; empty keeps the users of process-io
LegacyIoOwner string `json:"legacy_io_owner" env_var:"LEGACY_IO_OWNER"`
// fog: the HTTP policy of this gateway (NS-04), set by the gateway module so that its owner
// decides what processes may call. With HTTP_ENABLED set it replaces the fog policy of every
// namespace that came from the cloud; unset, the namespaces decide. Lists are comma
// separated; without allow lists, every target no deny list names is allowed.
HttpEnabled string `json:"http_enabled" env_var:"HTTP_ENABLED"`
HttpAllowHosts string `json:"http_allow_hosts" env_var:"HTTP_ALLOW_HOSTS"`
HttpDenyHosts string `json:"http_deny_hosts" env_var:"HTTP_DENY_HOSTS"`
HttpAllowNetworks string `json:"http_allow_networks" env_var:"HTTP_ALLOW_NETWORKS"`
HttpDenyNetworks string `json:"http_deny_networks" env_var:"HTTP_DENY_NETWORKS"`
HttpAllowPorts string `json:"http_allow_ports" env_var:"HTTP_ALLOW_PORTS"`
HttpTimeout string `json:"http_timeout" env_var:"HTTP_TIMEOUT"`
HttpMaxResponseBytes int `json:"http_max_response_bytes" env_var:"HTTP_MAX_RESPONSE_BYTES"`
// limits of the process-io store per user (LONG-11)
MaxIoValuesPerUser int `json:"max_io_values_per_user" env_var:"MAX_IO_VALUES_PER_USER"`
MaxIoValueBytes int `json:"max_io_value_bytes" env_var:"MAX_IO_VALUE_BYTES"`
// seeds namespaces that do not exist yet; afterwards the admin API manages them (NS-02)
Namespaces []model.Namespace `json:"namespaces" env_var:"NAMESPACES"`
}
func (Config) LocalHttpPolicy ¶ added in v0.5.0
func (this Config) LocalHttpPolicy() (policy model.HttpPolicy, local bool, err error)
LocalHttpPolicy is the HTTP policy the gateway sets for itself; local is false without http_enabled, then the policy of the namespace applies.