From be22bd58d0f155387ee1a3ffb2e1123b154f992f Mon Sep 17 00:00:00 2001 From: Bakir Date: Fri, 17 Jul 2026 16:00:01 +0200 Subject: [PATCH 01/10] switched to github variables, ready to test --- flagsmith-jira-app/manifest.yml | 10 ++++++++-- flagsmith-jira-app/src/backend/config.ts | 13 +++++++++++++ flagsmith-jira-app/src/backend/flagsmith.ts | 4 +++- flagsmith-jira-app/src/common.ts | 7 ++++--- .../src/frontend/components/IssueFeatureTables.tsx | 14 ++++++++++++-- flagsmith-jira-app/src/frontend/config.ts | 6 ++++++ flagsmith-jira-app/src/index.ts | 3 +++ 7 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 flagsmith-jira-app/src/backend/config.ts create mode 100644 flagsmith-jira-app/src/frontend/config.ts diff --git a/flagsmith-jira-app/manifest.yml b/flagsmith-jira-app/manifest.yml index 384d175..9d310d8 100644 --- a/flagsmith-jira-app/manifest.yml +++ b/flagsmith-jira-app/manifest.yml @@ -1,5 +1,5 @@ app: - id: ari:cloud:ecosystem::app/9ea1f892-1356-44bd-9ac8-684abf3a5714 + id: ari:cloud:ecosystem::app/${FORGE_APP_ID} runtime: name: nodejs22.x modules: @@ -54,4 +54,10 @@ permissions: external: fetch: backend: - - api.flagsmith.com + - ${FLAGSMITH_BACKEND_HOST} +environment: + variables: + - key: FORGE_APP_ID + default: 9ea1f892-1356-44bd-9ac8-684abf3a5714 + - key: FLAGSMITH_BACKEND_HOST + default: api.flagsmith.com diff --git a/flagsmith-jira-app/src/backend/config.ts b/flagsmith-jira-app/src/backend/config.ts new file mode 100644 index 0000000..237b259 --- /dev/null +++ b/flagsmith-jira-app/src/backend/config.ts @@ -0,0 +1,13 @@ +import { DEFAULT_FLAGSMITH_APP } from "../common"; + +/** Configuration exposed to the frontend (which cannot read process.env directly) */ +export type Config = { + flagsmithApp: string; +}; + +export type ReadConfig = () => Promise; + +/** Read frontend-visible configuration from runtime environment variables */ +export const readConfig: ReadConfig = async () => ({ + flagsmithApp: process.env.FLAGSMITH_APP ?? DEFAULT_FLAGSMITH_APP, +}); diff --git a/flagsmith-jira-app/src/backend/flagsmith.ts b/flagsmith-jira-app/src/backend/flagsmith.ts index c0895c3..04b92e7 100644 --- a/flagsmith-jira-app/src/backend/flagsmith.ts +++ b/flagsmith-jira-app/src/backend/flagsmith.ts @@ -1,8 +1,10 @@ import api, { APIResponse, Route, assumeTrustedRoute, route } from "@forge/api"; -import { ApiArgs, ApiError, FLAGSMITH_API_V1 } from "../common"; +import { ApiArgs, ApiError, DEFAULT_FLAGSMITH_API_V1 } from "../common"; import { readApiKey, readOrganisationId } from "./storage"; +const FLAGSMITH_API_V1 = process.env.FLAGSMITH_API_V1 ?? DEFAULT_FLAGSMITH_API_V1; + type Model = { id: number; name: string; diff --git a/flagsmith-jira-app/src/common.ts b/flagsmith-jira-app/src/common.ts index f4a05c0..f0703cf 100644 --- a/flagsmith-jira-app/src/common.ts +++ b/flagsmith-jira-app/src/common.ts @@ -1,9 +1,10 @@ import { RequestInit } from "@forge/api"; import { useEffect, useState } from "react"; -// TODO later: these could be set from environment variables for self-hosted users -export const FLAGSMITH_API_V1 = "https://api.flagsmith.com/api/v1"; -export const FLAGSMITH_APP = "https://app.flagsmith.com"; +// SaaS defaults; overridden per Forge environment via the FLAGSMITH_API_V1 and +// FLAGSMITH_APP runtime variables (see src/backend/config.ts). +export const DEFAULT_FLAGSMITH_API_V1 = "https://api.flagsmith.com/api/v1"; +export const DEFAULT_FLAGSMITH_APP = "https://app.flagsmith.com"; export type ApiArgs = Partial<{ method: RequestInit["method"]; diff --git a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx index d7d787b..0a98700 100644 --- a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx +++ b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx @@ -13,7 +13,8 @@ import { } from "@forge/react"; import { Fragment, useCallback, useState } from "react"; -import { FLAGSMITH_APP, usePromise } from "../../common"; +import { usePromise } from "../../common"; +import { readConfig } from "../config"; import { Environment, EnvironmentFeatureState, @@ -133,11 +134,13 @@ type IssueFeatureTableProps = { environments: Environment[]; // must be non-empty // list of same feature in the context of each environment environmentFeatures: Feature[]; + flagsmithApp: string; }; const IssueFeatureTable = ({ environments, environmentFeatures, + flagsmithApp, }: IssueFeatureTableProps): JSX.Element => { // catch API errors per table rather than cause whole component to fail const [error, setError] = useState(); @@ -146,7 +149,7 @@ const IssueFeatureTable = ({ const featureId = environmentFeatures[0]!.id; const featureName = environmentFeatures[0]!.name; const featureProjectId = environmentFeatures[0]!.project; - const projectUrl = `${FLAGSMITH_APP}/project/${featureProjectId}`; + const projectUrl = `${flagsmithApp}/project/${featureProjectId}`; /** Read feature state for each environment */ const readFeatureState = useCallback(async (): Promise => { @@ -294,6 +297,8 @@ const IssueFeatureTables = ({ environmentsFeatures, issueFeatureIds, }: IssueFeatureTablesProps): JSX.Element => { + const [config] = usePromise(readConfig, []); + if ( environmentsFeatures.length === 0 || environmentsFeatures[0] === undefined || @@ -302,6 +307,10 @@ const IssueFeatureTables = ({ return ; } + if (config === undefined) { + return ; + } + // iterate features from the first environment to get list of tables // (id/name/description are the same across environments) const features = environmentsFeatures[0]; @@ -329,6 +338,7 @@ const IssueFeatureTables = ({ ), diff --git a/flagsmith-jira-app/src/frontend/config.ts b/flagsmith-jira-app/src/frontend/config.ts new file mode 100644 index 0000000..b4be482 --- /dev/null +++ b/flagsmith-jira-app/src/frontend/config.ts @@ -0,0 +1,6 @@ +import { ReadConfig } from "../backend/config"; +import { customInvoke } from "./invoke"; +export { Config } from "../backend/config"; + +/** Read frontend-visible configuration from the backend resolver */ +export const readConfig: ReadConfig = async () => customInvoke("readConfig"); diff --git a/flagsmith-jira-app/src/index.ts b/flagsmith-jira-app/src/index.ts index 690bbe9..b79f165 100644 --- a/flagsmith-jira-app/src/index.ts +++ b/flagsmith-jira-app/src/index.ts @@ -1,6 +1,7 @@ import Resolver from "@forge/resolver"; import { canEditIssue, canAdministrate, canAdministrateProject } from "./backend/auth"; +import { readConfig } from "./backend/config"; import { readEnvironmentFeatureState, readEnvironments, @@ -31,6 +32,8 @@ const resolver = new Resolver(); resolver.define("canEditIssue", async ({ payload }) => canEditIssue(payload).catch(returnError)); +resolver.define("readConfig", async () => readConfig().catch(returnError)); + const checkPermission = async (hasPermission: () => Promise) => { if (!(await hasPermission())) throw new ApiError("Forbidden", 403); }; From 6f71b5438f45e28ec740b11addae5df845a83e25 Mon Sep 17 00:00:00 2001 From: Bakir Date: Fri, 17 Jul 2026 16:44:20 +0200 Subject: [PATCH 02/10] add deploy.yml --- .github/workflows/_deploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index b8d5796..c3bf7a1 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -40,5 +40,27 @@ jobs: - name: Install app dependencies run: npm ci + # Manifest variables: substituted into manifest.yml by the Forge CLI from + # the shell at deploy time. Only override the SaaS defaults when provided. + - name: Set manifest variables + run: | + if [ -n "${{ vars.FORGE_APP_ID }}" ]; then + echo "FORGE_APP_ID=${{ vars.FORGE_APP_ID }}" >> "$GITHUB_ENV" + fi + if [ -n "${{ vars.FLAGSMITH_BACKEND_HOST }}" ]; then + echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV" + fi + + # Runtime variables: stored by Forge and read via process.env in functions. + # Only set them when provided; otherwise the code falls back to SaaS defaults. + - name: Set runtime variables + run: | + if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ]; then + forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} + fi + if [ -n "${{ vars.FLAGSMITH_APP }}" ]; then + forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} + fi + - name: Deploy run: forge deploy --environment ${{ inputs.environment }} --non-interactive From a0b57ac8b24d9887eaec7dc1ed3dd064c150fdda Mon Sep 17 00:00:00 2001 From: Bakir Date: Mon, 20 Jul 2026 13:17:11 +0200 Subject: [PATCH 03/10] added if statement to check for empty string --- .github/workflows/_deploy.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index c3bf7a1..95830b1 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -44,21 +44,20 @@ jobs: # the shell at deploy time. Only override the SaaS defaults when provided. - name: Set manifest variables run: | - if [ -n "${{ vars.FORGE_APP_ID }}" ]; then + if [ -n "${{ vars.FORGE_APP_ID }}" ] && [ "${{ vars.FORGE_APP_ID }}" != "" ]; then echo "FORGE_APP_ID=${{ vars.FORGE_APP_ID }}" >> "$GITHUB_ENV" fi - if [ -n "${{ vars.FLAGSMITH_BACKEND_HOST }}" ]; then + if [ -n "${{ vars.FLAGSMITH_BACKEND_HOST }}" ] && [ "${{ vars.FLAGSMITH_BACKEND_HOST }}" != "" ]; then echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV" fi - # Runtime variables: stored by Forge and read via process.env in functions. # Only set them when provided; otherwise the code falls back to SaaS defaults. - name: Set runtime variables run: | - if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ]; then + if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ] && [ "${{ vars.FLAGSMITH_API_V1 }}" != "" ]; then forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} fi - if [ -n "${{ vars.FLAGSMITH_APP }}" ]; then + if [ -n "${{ vars.FLAGSMITH_APP }}" ] && [ "${{ vars.FLAGSMITH_APP }}" != "" ]; then forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} fi From c3420a967273033abe9f06a8c362ab188733fe95 Mon Sep 17 00:00:00 2001 From: Bakir Date: Mon, 20 Jul 2026 13:32:38 +0200 Subject: [PATCH 04/10] changed ?? to || --- .github/workflows/_deploy.yml | 8 ++++---- flagsmith-jira-app/src/backend/config.ts | 2 +- flagsmith-jira-app/src/backend/flagsmith.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index 95830b1..bd3bada 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -44,20 +44,20 @@ jobs: # the shell at deploy time. Only override the SaaS defaults when provided. - name: Set manifest variables run: | - if [ -n "${{ vars.FORGE_APP_ID }}" ] && [ "${{ vars.FORGE_APP_ID }}" != "" ]; then + if [ -n "${{ vars.FORGE_APP_ID }}" ]; then echo "FORGE_APP_ID=${{ vars.FORGE_APP_ID }}" >> "$GITHUB_ENV" fi - if [ -n "${{ vars.FLAGSMITH_BACKEND_HOST }}" ] && [ "${{ vars.FLAGSMITH_BACKEND_HOST }}" != "" ]; then + if [ -n "${{ vars.FLAGSMITH_BACKEND_HOST }}" ]; then echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV" fi # Runtime variables: stored by Forge and read via process.env in functions. # Only set them when provided; otherwise the code falls back to SaaS defaults. - name: Set runtime variables run: | - if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ] && [ "${{ vars.FLAGSMITH_API_V1 }}" != "" ]; then + if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ]; then forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} fi - if [ -n "${{ vars.FLAGSMITH_APP }}" ] && [ "${{ vars.FLAGSMITH_APP }}" != "" ]; then + if [ -n "${{ vars.FLAGSMITH_APP }}" ]; then forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} fi diff --git a/flagsmith-jira-app/src/backend/config.ts b/flagsmith-jira-app/src/backend/config.ts index 237b259..1255e8b 100644 --- a/flagsmith-jira-app/src/backend/config.ts +++ b/flagsmith-jira-app/src/backend/config.ts @@ -9,5 +9,5 @@ export type ReadConfig = () => Promise; /** Read frontend-visible configuration from runtime environment variables */ export const readConfig: ReadConfig = async () => ({ - flagsmithApp: process.env.FLAGSMITH_APP ?? DEFAULT_FLAGSMITH_APP, + flagsmithApp: process.env.FLAGSMITH_APP || DEFAULT_FLAGSMITH_APP, }); diff --git a/flagsmith-jira-app/src/backend/flagsmith.ts b/flagsmith-jira-app/src/backend/flagsmith.ts index 04b92e7..4987f59 100644 --- a/flagsmith-jira-app/src/backend/flagsmith.ts +++ b/flagsmith-jira-app/src/backend/flagsmith.ts @@ -3,7 +3,7 @@ import api, { APIResponse, Route, assumeTrustedRoute, route } from "@forge/api"; import { ApiArgs, ApiError, DEFAULT_FLAGSMITH_API_V1 } from "../common"; import { readApiKey, readOrganisationId } from "./storage"; -const FLAGSMITH_API_V1 = process.env.FLAGSMITH_API_V1 ?? DEFAULT_FLAGSMITH_API_V1; +const FLAGSMITH_API_V1 = process.env.FLAGSMITH_API_V1 || DEFAULT_FLAGSMITH_API_V1; type Model = { id: number; From e7089c68e40e421308d268ce2051cdd1bcb57851 Mon Sep 17 00:00:00 2001 From: Bakir Date: Mon, 20 Jul 2026 14:26:26 +0200 Subject: [PATCH 05/10] added forge unset to deploy.yml --- .github/workflows/_deploy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index bd3bada..ed68562 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -51,14 +51,19 @@ jobs: echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV" fi # Runtime variables: stored by Forge and read via process.env in functions. - # Only set them when provided; otherwise the code falls back to SaaS defaults. + # Set them when provided; otherwise unset any stale value so the code falls + # back to SaaS defaults. Unsetting is idempotent (|| true tolerates absence). - name: Set runtime variables run: | if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ]; then forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} + else + forge variables unset FLAGSMITH_API_V1 --environment ${{ inputs.environment }} || true fi if [ -n "${{ vars.FLAGSMITH_APP }}" ]; then forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} + else + forge variables unset FLAGSMITH_APP --environment ${{ inputs.environment }} || true fi - name: Deploy From 4e361d4b4b92f16276e003bc7ec4f4b3e476abe9 Mon Sep 17 00:00:00 2001 From: Bakir Date: Thu, 23 Jul 2026 13:38:19 +0200 Subject: [PATCH 06/10] working on pr --- .../src/frontend/components/IssueFeatureTables.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx index 0a98700..9cb8b2e 100644 --- a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx +++ b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx @@ -307,10 +307,6 @@ const IssueFeatureTables = ({ return ; } - if (config === undefined) { - return ; - } - // iterate features from the first environment to get list of tables // (id/name/description are the same across environments) const features = environmentsFeatures[0]; From c432712b074270b8b39c4a45e6d24b2e1e3f35f0 Mon Sep 17 00:00:00 2001 From: Bakir Date: Thu, 23 Jul 2026 14:09:14 +0200 Subject: [PATCH 07/10] removed undefined check for config --- .../src/frontend/components/IssueFeatureTables.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx index 9cb8b2e..329ea61 100644 --- a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx +++ b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx @@ -13,7 +13,7 @@ import { } from "@forge/react"; import { Fragment, useCallback, useState } from "react"; -import { usePromise } from "../../common"; +import { DEFAULT_FLAGSMITH_APP, usePromise } from "../../common"; import { readConfig } from "../config"; import { Environment, @@ -297,7 +297,7 @@ const IssueFeatureTables = ({ environmentsFeatures, issueFeatureIds, }: IssueFeatureTablesProps): JSX.Element => { - const [config] = usePromise(readConfig, []); + const [config = { flagsmithApp: DEFAULT_FLAGSMITH_APP }] = usePromise(readConfig, []); if ( environmentsFeatures.length === 0 || From 92a995491955fcd599d2cab3c061473db93e171e Mon Sep 17 00:00:00 2001 From: Bakir Date: Thu, 23 Jul 2026 15:14:21 +0200 Subject: [PATCH 08/10] restructured fe/be config --- flagsmith-jira-app/src/backend/config.ts | 13 ------------- flagsmith-jira-app/src/backend/flagsmith.ts | 13 ++++++++++++- flagsmith-jira-app/src/common.ts | 7 +++++++ .../src/frontend/components/IssueFeatureTables.tsx | 2 +- flagsmith-jira-app/src/frontend/config.ts | 6 ------ flagsmith-jira-app/src/frontend/flagsmith.ts | 4 ++++ flagsmith-jira-app/src/index.ts | 2 +- 7 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 flagsmith-jira-app/src/backend/config.ts delete mode 100644 flagsmith-jira-app/src/frontend/config.ts diff --git a/flagsmith-jira-app/src/backend/config.ts b/flagsmith-jira-app/src/backend/config.ts deleted file mode 100644 index 1255e8b..0000000 --- a/flagsmith-jira-app/src/backend/config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { DEFAULT_FLAGSMITH_APP } from "../common"; - -/** Configuration exposed to the frontend (which cannot read process.env directly) */ -export type Config = { - flagsmithApp: string; -}; - -export type ReadConfig = () => Promise; - -/** Read frontend-visible configuration from runtime environment variables */ -export const readConfig: ReadConfig = async () => ({ - flagsmithApp: process.env.FLAGSMITH_APP || DEFAULT_FLAGSMITH_APP, -}); diff --git a/flagsmith-jira-app/src/backend/flagsmith.ts b/flagsmith-jira-app/src/backend/flagsmith.ts index 4987f59..5799891 100644 --- a/flagsmith-jira-app/src/backend/flagsmith.ts +++ b/flagsmith-jira-app/src/backend/flagsmith.ts @@ -1,6 +1,12 @@ import api, { APIResponse, Route, assumeTrustedRoute, route } from "@forge/api"; -import { ApiArgs, ApiError, DEFAULT_FLAGSMITH_API_V1 } from "../common"; +import { + ApiArgs, + ApiError, + DEFAULT_FLAGSMITH_API_V1, + DEFAULT_FLAGSMITH_APP, + ReadConfig, +} from "../common"; import { readApiKey, readOrganisationId } from "./storage"; const FLAGSMITH_API_V1 = process.env.FLAGSMITH_API_V1 || DEFAULT_FLAGSMITH_API_V1; @@ -243,3 +249,8 @@ export const readEnvironmentFeatureState: ReadEnvironmentFeatureState = async ({ return results[0] as EnvironmentFeatureState; } }; + +/** Read frontend-visible configuration from runtime environment variables */ +export const readConfig: ReadConfig = async () => ({ + flagsmithApp: process.env.FLAGSMITH_APP || DEFAULT_FLAGSMITH_APP, +}); diff --git a/flagsmith-jira-app/src/common.ts b/flagsmith-jira-app/src/common.ts index f0703cf..20ce911 100644 --- a/flagsmith-jira-app/src/common.ts +++ b/flagsmith-jira-app/src/common.ts @@ -25,6 +25,13 @@ export class ApiError extends Error { export type ErrorPayload = { error: Error }; +/** Frontend-visible configuration passed back across the invoke bridge */ +export type Config = { + flagsmithApp: string; +}; + +export type ReadConfig = () => Promise; + /** Use a promise safely i.e. ignore result if subsequently unmounted */ export const usePromise = ( promise: () => Promise, diff --git a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx index 329ea61..d1d49ee 100644 --- a/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx +++ b/flagsmith-jira-app/src/frontend/components/IssueFeatureTables.tsx @@ -14,7 +14,7 @@ import { import { Fragment, useCallback, useState } from "react"; import { DEFAULT_FLAGSMITH_APP, usePromise } from "../../common"; -import { readConfig } from "../config"; +import { readConfig } from "../flagsmith"; import { Environment, EnvironmentFeatureState, diff --git a/flagsmith-jira-app/src/frontend/config.ts b/flagsmith-jira-app/src/frontend/config.ts deleted file mode 100644 index b4be482..0000000 --- a/flagsmith-jira-app/src/frontend/config.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ReadConfig } from "../backend/config"; -import { customInvoke } from "./invoke"; -export { Config } from "../backend/config"; - -/** Read frontend-visible configuration from the backend resolver */ -export const readConfig: ReadConfig = async () => customInvoke("readConfig"); diff --git a/flagsmith-jira-app/src/frontend/flagsmith.ts b/flagsmith-jira-app/src/frontend/flagsmith.ts index 7ac03c6..208685e 100644 --- a/flagsmith-jira-app/src/frontend/flagsmith.ts +++ b/flagsmith-jira-app/src/frontend/flagsmith.ts @@ -5,6 +5,7 @@ import { ReadOrganisations, ReadProjects, } from "../backend/flagsmith"; +import type { ReadConfig } from "../common"; import { customInvoke } from "./invoke"; export { Environment, @@ -35,3 +36,6 @@ export const readEnvironmentFeatureState: ReadEnvironmentFeatureState = async ({ envApiKey, featureName, }) => customInvoke("readEnvironmentFeatureState", { envApiKey, featureName }); + +/** Read frontend-visible configuration from the backend resolver */ +export const readConfig: ReadConfig = async () => customInvoke("readConfig"); diff --git a/flagsmith-jira-app/src/index.ts b/flagsmith-jira-app/src/index.ts index b79f165..d576de6 100644 --- a/flagsmith-jira-app/src/index.ts +++ b/flagsmith-jira-app/src/index.ts @@ -1,8 +1,8 @@ import Resolver from "@forge/resolver"; import { canEditIssue, canAdministrate, canAdministrateProject } from "./backend/auth"; -import { readConfig } from "./backend/config"; import { + readConfig, readEnvironmentFeatureState, readEnvironments, readFeatures, From 3059ca4e33ef3bb5f786fa80d96fc8b25ffca1c5 Mon Sep 17 00:00:00 2001 From: Bakir Date: Tue, 28 Jul 2026 15:16:42 +0200 Subject: [PATCH 09/10] removed set/unset forge variables --- .github/workflows/_deploy.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index ed68562..bcc108e 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -51,20 +51,12 @@ jobs: echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV" fi # Runtime variables: stored by Forge and read via process.env in functions. - # Set them when provided; otherwise unset any stale value so the code falls - # back to SaaS defaults. Unsetting is idempotent (|| true tolerates absence). + # Always set them; an empty value is falsy, so the code's `|| DEFAULT` + # fallback yields the SaaS defaults just as an unset variable would. - name: Set runtime variables run: | - if [ -n "${{ vars.FLAGSMITH_API_V1 }}" ]; then - forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} - else - forge variables unset FLAGSMITH_API_V1 --environment ${{ inputs.environment }} || true - fi - if [ -n "${{ vars.FLAGSMITH_APP }}" ]; then - forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} - else - forge variables unset FLAGSMITH_APP --environment ${{ inputs.environment }} || true - fi + forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} + forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} - name: Deploy run: forge deploy --environment ${{ inputs.environment }} --non-interactive From 6ab71c58e8182b3473539dfacb78613e72b5595c Mon Sep 17 00:00:00 2001 From: Bakir Date: Tue, 28 Jul 2026 17:25:06 +0200 Subject: [PATCH 10/10] add --non-interactive to forge variables set Prevents the encryption prompt from failing the deploy in CI's non-TTY environment. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index bcc108e..a765a12 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -55,8 +55,8 @@ jobs: # fallback yields the SaaS defaults just as an unset variable would. - name: Set runtime variables run: | - forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} - forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} + forge variables set FLAGSMITH_API_V1 "${{ vars.FLAGSMITH_API_V1 }}" --environment ${{ inputs.environment }} --non-interactive + forge variables set FLAGSMITH_APP "${{ vars.FLAGSMITH_APP }}" --environment ${{ inputs.environment }} --non-interactive - name: Deploy run: forge deploy --environment ${{ inputs.environment }} --non-interactive