Skip to content

feat: removed hard-coded configuration parameters in preparation for automated client deployment - #65

Open
bakirFS wants to merge 10 commits into
mainfrom
feat/switch-to-github-variables
Open

feat: removed hard-coded configuration parameters in preparation for automated client deployment#65
bakirFS wants to merge 10 commits into
mainfrom
feat/switch-to-github-variables

Conversation

@bakirFS

@bakirFS bakirFS commented Jul 17, 2026

Copy link
Copy Markdown

Contributes to #59

Created this PR to remove hard-coded variables from code which caused us to have bespoke deployments for each customer using private cloud.

I left old hard-coded values as defaults, so if you want to override them you need to provide values in github variables.
Those are: FLAGSMITH_BACKEND_HOST, FORGE_APP_ID, FLAGSMITH_APP and FLAGSMITH_API_V1.

Changes have been tested by providing invalid manifest variables (FLAGSMITH_BACKEND_HOST) which made the deployment fail and by providing invalid runtime variables (FLAGSMITH_API_V1) which deployed the app but not communicate with the API.

@bakirFS
bakirFS requested a review from a team as a code owner July 17, 2026 14:18
@bakirFS
bakirFS requested review from talissoncosta and removed request for a team July 17, 2026 14:18
@bakirFS
bakirFS requested review from matthewelwell and removed request for talissoncosta July 20, 2026 13:09
Comment thread .github/workflows/_deploy.yml Outdated
Comment on lines +43 to +67
# 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.
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, I do understand why we have this logic to verify if the values exists, but thinking about it logically this YAML file is only used by us for deploying to our SaaS environments, and these variables are all visible in the Github interface (since they're vars and not secrets) so I would suggest that this workflow shouldn't care about whether they exist or not.

Suggested change
# 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.
# 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
# Manifest variables: substituted into manifest.yml by the Forge CLI from
# the shell at deploy time.
- name: Set manifest variables
run: |
echo "FORGE_APP_ID=${{ vars.FORGE_APP_ID }}" >> "$GITHUB_ENV"
echo "FLAGSMITH_BACKEND_HOST=${{ vars.FLAGSMITH_BACKEND_HOST }}" >> "$GITHUB_ENV"
# Runtime variables: stored by Forge and read via process.env in functions.
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 }}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understood you, did you mean I should remove the if statement since the values will always be set?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed in Slack - yes, that's what I mean.

Comment on lines +310 to +312
if (config === undefined) {
return <Spinner label="Loading feature flag state" />;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why config would ever be undefined? And if it were, why that would be temporary (and hence warrant a spinner)?

import { customInvoke } from "./invoke";
export { Config } from "../backend/config";

/** Read frontend-visible configuration from the backend resolver */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading across the frontend / backend separations feels a bit odd here - is there a way around this?

Prevents the encryption prompt from failing the deploy in CI's non-TTY
environment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants