Skip to content

Instantly share code, notes, and snippets.

@vkuznet
Created June 20, 2017 21:19
Show Gist options
  • Save vkuznet/49d07398357d88e9b967b3c9722083de to your computer and use it in GitHub Desktop.
Save vkuznet/49d07398357d88e9b967b3c9722083de to your computer and use it in GitHub Desktop.
Example of micro-service configuration file
"""
MicroService configuration file.
"""
import os
import socket
from WMCore.Configuration import Configuration
# globals
HOST = socket.gethostname().lower()
ROOTDIR = os.getenv('MS_STATIC_ROOT', os.getcwd())
config = Configuration()
main = config.section_("main")
srv = main.section_("server")
srv.thread_pool = 30
main.application = "microservice"
main.port = 8822 # main application port it listens on
main.index = 'data' # Configuration requires index attribute
# Security configuration
#main.authz_defaults = {"role": None, "group": None, "site": None}
#sec = main.section_("tools").section_("cms_auth")
#sec.key_file = "%s/auth/wmcore-auth/header-auth-key" % ROOTDIR
# this is where the application will be mounted, where the REST API
# is reachable and this features in CMS web frontend rewrite rules
app = config.section_(main.application)
app.admin = "[email protected]"
app.description = "CMS data operations MicroService"
app.title = "CMS MicroService"
# define different views for our application
views = config.section_("views")
# web UI interface
ui = views.section_('web') # was section 'ui'
ui.object = 'WMCore.Services.MicroService.FrontPage.FrontPage'
ui.static = ROOTDIR
# REST interface
data = views.section_('data')
data.object = 'WMCore.Services.MicroService.RestApi.RestInterface'
data.manager = 'WMCore.Services.MicroService.UnifiedStageout.UnifiedStageoutManager'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment