def env_for_plugin(plugin): env_struct = { "meltano": { plugin.type.singular: { # MELTANO_EXTRACTOR_... "name": plugin.name, "namespace": plugin.namespace, }, plugin.type.singular[0:-2]: plugin.config, # MELTANO_EXTRACT_... }, **plugin.config_env, # TAP_... } env_vars = flatten(env_struct, "env_var").items() return {k: str(v) for k, v in env_vars if v is not None}
def get_plugin_configuration(plugin_ref) -> Response: """ endpoint for getting a plugin's configuration """ project = Project.find() settings = PluginSettingsService(project) config = flatten(settings.as_config(db.session, plugin_ref, redacted=True), reducer="dot") return jsonify({ # freeze the keys because they are used for lookups "config": freeze_keys(config), "settings": settings.get_definition(plugin_ref).settings, })
def config_metadata_rules(config): flat_config = flatten(config, "dot") rules = [] for key, value in flat_config.items(): # <tap_stream_id>.<key> # <tap_stream_id>.<prop>.<key> # <tap_stream_id>.<prop>.<subprop>.<key> # <tap_stream_id>.properties.<prop>.<key> # <tap_stream_id>.properties.<prop>.properties.<subprop>.<key> tap_stream_id, *props, key = key.split(".") rules.append( MetadataRule( tap_stream_id=tap_stream_id, breadcrumb=property_breadcrumb(props), key=key, value=value, )) return rules
def flat_meltano_yml_config(self): return flatten(self.meltano_yml_config, "dot")
def info_env(self): # MELTANO_EXTRACTOR_... return flatten({"meltano": {self.type.singular: self.info}}, "env_var")
def flat_current_config(self): return flatten(self._current_config, "dot")