From 158ef63f36193769eefa58445e8a76fa7846f9d8 Mon Sep 17 00:00:00 2001 From: William Petit Date: Fri, 1 Mar 2024 13:24:51 +0100 Subject: [PATCH] feat: add configurable agent and claim url for status page ref https://forge.cadoles.com/arcad/emissary/issues/21 --- install/emissary-files.mk | 2 ++ misc/emissary/config/emissary | 2 ++ misc/emissary/init.d/emissary-agent | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/install/emissary-files.mk b/install/emissary-files.mk index 153ef0a..baf1dd4 100644 --- a/install/emissary-files.mk +++ b/install/emissary-files.mk @@ -33,6 +33,8 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.sentry.dsn = "$${EMISSARY_SENTRY_DSN}"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.sentry.environment = "$${EMISSARY_SENTRY_ENVIRONMENT}"' files/etc/emissary/agent.yml + tools/yq/bin/yq -i '.agent.controllers.status.claimURL = "$${EMISSARY_CONTROLLERS_STATUS_CLAIM_URL}"' files/etc/emissary/agent.yml + tools/yq/bin/yq -i '.agent.controllers.status.agentURL = "$${EMISSARY_CONTROLLERS_STATUS_AGENT_URL}"' files/etc/emissary/agent.yml # Copy emissary binary mkdir -p files/usr/local/bin diff --git a/misc/emissary/config/emissary b/misc/emissary/config/emissary index 4d82876..e1f22f4 100644 --- a/misc/emissary/config/emissary +++ b/misc/emissary/config/emissary @@ -3,5 +3,7 @@ package emissary config main 'agent' option reconciliation_interval '60' option server_url 'https://emissary.cadol.es' + option claim_url 'https://emissary.cadol.es/hq/claim/%v' + option agent_url 'https://emissary.cadol.es/hq/agents/%v' option sentry_dsn '' option sentry_environment '' \ No newline at end of file diff --git a/misc/emissary/init.d/emissary-agent b/misc/emissary/init.d/emissary-agent index 128faf8..b0f90ef 100755 --- a/misc/emissary/init.d/emissary-agent +++ b/misc/emissary/init.d/emissary-agent @@ -12,12 +12,14 @@ start_service() { config_get emissary_reconciliation_interval agent 'reconciliation_interval' "60" config_get emissary_server_url agent 'server_url' "https://emissary.cadol.es" + config_get emissary_agent_claim_url agent 'claim_url' "https://emissary.cadol.es/hq/claim/%v" + config_get emissary_agent_url agent 'agent_url' "https://emissary.cadol.es/hq/agents/%v" config_get emissary_sentry_dsn agent 'sentry_dsn' "" config_get emissary_sentry_environment agent 'sentry_environment' "" local config_file="/etc/emissary/agent.yml" procd_open_instance emissary-agent - procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval" EMISSARY_SENTRY_DSN="$emissary_sentry_dsn" EMISSARY_SENTRY_ENVIRONMENT="$emissary_sentry_environment" + procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval" EMISSARY_SENTRY_DSN="$emissary_sentry_dsn" EMISSARY_SENTRY_ENVIRONMENT="$emissary_sentry_environment" EMISSARY_CONTROLLERS_STATUS_CLAIM_URL="$emissary_agent_claim_url" EMISSARY_CONTROLLERS_STATUS_AGENT_URL="$emissary_agent_url" procd_set_param command /usr/local/bin/emissary procd_append_param command --workdir /usr/share/emissary procd_append_param command --config "$config_file"