Skip to content

Commit

Permalink
Use AUTO_UPDATE_URL env to fetch bored-agent manifests (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
  • Loading branch information
nevalla and jakolehm authored Apr 1, 2022
1 parent 80053a4 commit b29a6f3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ function getConfig() {
// e.g. "lens-platform"
NAMESPACE: process.env.NAMESPACE,

// e.g. "https://api.k8slens.dev"
// e.g. "https://api.k8slens.dev/bored-agent/v2/bored-agent.yml"
AUTO_UPDATE_URL: process.env.AUTO_UPDATE_URL,

/**
@deprecated Will be removed in favor of AUTO_UPDATE_URL
e.g. "https://api.k8slens.dev"
*/
LENS_BACKEND_URL: process.env.LENS_BACKEND_URL
};

Expand All @@ -84,7 +90,9 @@ function getConfig() {
type Config = ReturnType<typeof getConfig>;

async function fetchBoredAgentYml(config: Config) {
const url = `${config.LENS_BACKEND_URL}/bored-agent/v2/bored-agent.yml`;
const url = config.AUTO_UPDATE_URL ?
config.AUTO_UPDATE_URL :
`${config.LENS_BACKEND_URL}/bored-agent/v2/bored-agent.yml`;

console.log(`Fetching bored-agent.yml from ${url}`);

Expand All @@ -105,6 +113,7 @@ async function fetchBoredAgentYml(config: Config) {
.replaceAll("$BORED_TOKEN", `'${config.BORED_TOKEN}'`)
.replaceAll("$LENS_PLATFORM_K8S_CLUSTER_ID", `'${config.LENS_PLATFORM_K8S_CLUSTER_ID}'`)
.replaceAll("$LENS_PLATFORM_SPACE_NAME", `'${config.LENS_PLATFORM_SPACE_NAME}'`)
.replaceAll("$AUTO_UPDATE_URL", `'${config.AUTO_UPDATE_URL}'`)
.replaceAll("$LENS_BACKEND_URL", `'${config.LENS_BACKEND_URL}'`);

return yml;
Expand Down

0 comments on commit b29a6f3

Please sign in to comment.