diff --git a/conf/st2.conf.sample b/conf/st2.conf.sample index 22ad407a37..dada02cf2b 100644 --- a/conf/st2.conf.sample +++ b/conf/st2.conf.sample @@ -97,6 +97,8 @@ packs_base_paths = None [coordination] # Endpoint for the coordination server. url = None +# True to register StackStorm services in a service registry. +service_registry = False # TTL for the lock if backend suports it. lock_timeout = 60 diff --git a/st2common/st2common/config.py b/st2common/st2common/config.py index 789a32c952..15d863a99f 100644 --- a/st2common/st2common/config.py +++ b/st2common/st2common/config.py @@ -441,7 +441,10 @@ def register_opts(ignore_errors=False): help='Endpoint for the coordination server.'), cfg.IntOpt( 'lock_timeout', default=60, - help='TTL for the lock if backend suports it.') + help='TTL for the lock if backend suports it.'), + cfg.BoolOpt( + 'service_registry', default=False, + help='True to register StackStorm services in a service registry.'), ] do_register_opts(coord_opts, 'coordination', ignore_errors) diff --git a/st2common/st2common/service_setup.py b/st2common/st2common/service_setup.py index 3c1002a0db..c37afff591 100644 --- a/st2common/st2common/service_setup.py +++ b/st2common/st2common/service_setup.py @@ -181,7 +181,7 @@ def setup(service, config, setup_db=True, register_mq_exchanges=True, metrics_initialize() # Register service in the service registry - if service_registry: + if cfg.CONF.coordination.service_registry and service_registry: # NOTE: It's important that we pass start_heart=True to start the hearbeat process register_service_in_service_registry(service=service, capabilities=capabilities, start_heart=True)