Skip to content

Commit

Permalink
Add options to enable LCM support (tech preview) (#766)
Browse files Browse the repository at this point in the history
* Add options to enable LCM support (tech preview)
  • Loading branch information
bartv authored Oct 19, 2018
1 parent 740b312 commit 8238fc6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/inmanta/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,21 @@ class TransportConfig(object):
"""
A class to register the config options for Client classes
"""
def __init__(self, name):
def __init__(self, name, port=8888):
self.prefix = "%s_rest_transport" % name
self.host = Option(self.prefix, "host", "localhost", "IP address or hostname of the server", is_str)
self.port = Option(self.prefix, "port", 8888, "Server port", is_int)
self.port = Option(self.prefix, "port", port, "Server port", is_int)
self.ssl = Option(self.prefix, "ssl", False, "Connect using SSL?", is_bool)
self.ssl_ca_cert_file = Option(self.prefix, "ssl_ca_cert_file", None,
"CA cert file used to validate the server certificate against", is_str_opt)
self.token = Option(self.prefix, "token", None, "The bearer token to use to connect to the API", is_str_opt)


compiler_transport = TransportConfig("compiler")
TransportConfig("client")
cmdline_rest_transport = TransportConfig("cmdline")
# LCM support should move to a server extension
service_api_transport = TransportConfig("service_api", port=8889)


#############################
Expand Down
2 changes: 2 additions & 0 deletions src/inmanta/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def validate_fact_renew(value):
dash_realm = Option("dashboard", "realm", "inmanta", "The realm to use for keycloak authentication.")
dash_auth_url = Option("dashboard", "auth_url", None, "The auth url of the keycloak server to use.")
dash_client_id = Option("dashboard", "client_id", None, "The client id configured in keycloak for this application.")
# LCM support should move to a server extension
dash_lcm_enable = Option("dashboard", "lcm", False, "Enable lifecycle manager in the dashboard", is_bool)


def default_hangtime():
Expand Down
10 changes: 9 additions & 1 deletion src/inmanta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,19 @@ def setup_dashboard(self):
'url': '%s',
'clientId': '%s'
}""" % (opt.dash_realm.get(), opt.dash_auth_url.get(), opt.dash_client_id.get())

# LCM support should move to a server extension
lcm = ""
if opt.dash_lcm_enable:
lcm = """,
'lcm': 'http://' + window.location.hostname + ':8889/'
"""

content = """
angular.module('inmantaApi.config', []).constant('inmantaConfig', {
'backend': window.location.origin+'/'%s
});
""" % auth
""" % (lcm + auth)
self.add_static_content("/dashboard/config.js", content=content)
self.add_static_handler("/dashboard", dashboard_path, start=True)

Expand Down

0 comments on commit 8238fc6

Please sign in to comment.