diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9099c14..ba5dd6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,4 +21,3 @@ jobs: - name: Check for Broken Links run: npx -y mint broken-links - diff --git a/.github/workflows/worker.yml b/.github/workflows/worker.yml deleted file mode 100644 index fef0e3c..0000000 --- a/.github/workflows/worker.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Test Worker Redirects - -on: - pull_request: - types: [opened, synchronize, reopened] - -jobs: - test: - runs-on: ubuntu-latest - permissions: - contents: read - deployments: write - pull-requests: write - - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install dependencies - working-directory: ./worker - run: npm install - - # Deploy preview - - name: Deploy Worker Preview - id: deploy - working-directory: ./worker - run: | - # Deploy the worker to preview environment - OUTPUT=$(npx wrangler deploy --config wrangler.jsonc --env preview 2>&1) - echo "$OUTPUT" - - # Extract the deployed URL from the output - # Look for the worker URL pattern - PREVIEW_URL=$(echo "$OUTPUT" | grep -o 'https://docs-preview[^[:space:]]*' | head -1) - - # If not found, try a more general pattern - if [ -z "$PREVIEW_URL" ]; then - PREVIEW_URL=$(echo "$OUTPUT" | grep -o 'https://[^[:space:]]*workers.dev' | head -1) - fi - - echo "Extracted preview URL: $PREVIEW_URL" - echo "preview_url=$PREVIEW_URL" >> $GITHUB_OUTPUT - - - name: Run redirect tests - id: tests - run: | - set -euo pipefail - - BASE_URL="${{ steps.deploy.outputs.preview_url }}" - echo "Testing against preview URL: $BASE_URL" - - echo "Testing root → /v2/" - LOCATION=$(curl -s -o /dev/null -w "%{redirect_url}" $BASE_URL/) - test "$LOCATION" = "$BASE_URL/v2/" - - echo "Testing unversioned path → /v1/path" - LOCATION=$(curl -s -o /dev/null -w "%{redirect_url}" $BASE_URL/getting-started) - test "$LOCATION" = "$BASE_URL/v1/getting-started" - - echo "Testing already versioned path (/v1) → no redirect" - STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-redirs 0 $BASE_URL/v1/getting-started) - # Should not get a redirect (301/302), might get 404 or 522 since there's no backend - if [ "$STATUS" -eq 301 ] || [ "$STATUS" -eq 302 ]; then - echo "ERROR: /v1/ path should not redirect but got status $STATUS" - exit 1 - fi - echo "✓ Got status $STATUS (not a redirect)" - - echo "Testing already versioned path (/v2) → no redirect" - STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-redirs 0 $BASE_URL/v2/getting-started) - # Should not get a redirect (301/302), might get 404 or 522 since there's no backend - if [ "$STATUS" -eq 301 ] || [ "$STATUS" -eq 302 ]; then - echo "ERROR: /v2/ path should not redirect but got status $STATUS" - exit 1 - fi - echo "✓ Got status $STATUS (not a redirect)" - - echo "Testing excluded path (.css) → no redirect" - STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-redirs 0 $BASE_URL/styles.css) - # Should not get a redirect (301/302), might get 404 or 522 since there's no backend - if [ "$STATUS" -eq 301 ] || [ "$STATUS" -eq 302 ]; then - echo "ERROR: .css path should not redirect but got status $STATUS" - exit 1 - fi - echo "✓ Got status $STATUS (not a redirect)" - - echo "✅ All redirect tests passed!" diff --git a/docs.json b/docs.json index 5a9e015..82f8778 100644 --- a/docs.json +++ b/docs.json @@ -37,10 +37,7 @@ "group": "Pro Features", "tag": "NEW", "icon": "crown", - "pages": [ - "v2/pro", - "v2/licensing" - ] + "pages": ["v2/pro", "v2/licensing"] }, { "group": "Configuration", @@ -66,9 +63,7 @@ "v2/integration/overview", { "group": "Server-Side SDKs", - "pages": [ - "v2/integration/server/rest" - ] + "pages": ["v2/integration/server/rest"] }, "v2/integration/client", "v2/integration/openfeature" @@ -143,9 +138,7 @@ }, { "group": "Migration Guides", - "pages": [ - "v2/guides/migration/cloud/flipt-cloud-to-v2" - ] + "pages": ["v2/guides/migration/cloud/flipt-cloud-to-v2"] } ] }, @@ -153,9 +146,7 @@ "group": "Tooling", "icon": "hammer", "tag": "NEW", - "pages": [ - "v2/tooling/github-actions" - ] + "pages": ["v2/tooling/github-actions"] } ] }, @@ -185,10 +176,7 @@ "groups": [ { "group": "Overview", - "pages": [ - "v1/introduction", - "v1/concepts" - ] + "pages": ["v1/introduction", "v1/concepts"] }, { "group": "Use Cases", @@ -333,9 +321,7 @@ }, { "group": "Authorization", - "pages": [ - "v1/authorization/overview" - ] + "pages": ["v1/authorization/overview"] }, { "group": "Operations", @@ -362,9 +348,7 @@ "groups": [ { "group": "Overview", - "pages": [ - "v1/reference/overview" - ] + "pages": ["v1/reference/overview"] }, { "group": "Authentication", @@ -475,9 +459,7 @@ { "anchor": "Changelog", "icon": "clock", - "pages": [ - "v1/changelog/overview" - ] + "pages": ["v1/changelog/overview"] }, { "anchor": "Blog", diff --git a/docs/v2/configuration/overview.mdx b/docs/v2/configuration/overview.mdx index 2eefd82..2e46712 100644 --- a/docs/v2/configuration/overview.mdx +++ b/docs/v2/configuration/overview.mdx @@ -181,18 +181,19 @@ Server configuration controls how Flipt listens for and serves HTTP, HTTPS, and Storage configuration defines where and how Flipt persists feature flag data, including local and remote Git repositories. -| Property | Description | Default | Since | -| ------------------------------ | ------------------------------------------------------------------- | ------------------- | ------ | -| storage.[id].name | The canonical name of the storage instance | default | v2.0.0 | -| storage.[id].backend.type | The type of backend to use (options: memory, local) | memory | v2.0.0 | -| storage.[id].backend.path | The path to the local storage directory for git backend | temporary directory | v2.0.0 | -| storage.[id].remote | The remote URL to sync storage to/from | | v2.0.0 | -| storage.[id].branch | The branch to use for git backend | main | v2.0.0 | -| storage.[id].poll_interval | The interval to poll the git repository and ref for changes | 30s | v2.0.0 | -| storage.[id].ca_cert_bytes | The CA certificate bytes for the remote URL | | v2.0.0 | -| storage.[id].ca_cert_path | The CA certificate path for the remote URL | | v2.0.0 | -| storage.[id].insecure_skip_tls | Skip verifying the server's certificate chain (avoid in production) | false | v2.0.0 | -| storage.[id].credentials | The id of the credentials to use for the remote URL | | v2.0.0 | +| Property | Description | Default | Since | +| ------------------------------ | ------------------------------------------------------------------------------------- | ------------------- | ------ | +| storage.[id].name | The canonical name of the storage instance | default | v2.0.0 | +| storage.[id].backend.type | The type of backend to use (options: memory, local) | memory | v2.0.0 | +| storage.[id].backend.path | The path to the local storage directory for git backend | temporary directory | v2.0.0 | +| storage.[id].remote | The remote URL to sync storage to/from | | v2.0.0 | +| storage.[id].branch | The branch to use for git backend | main | v2.0.0 | +| storage.[id].poll_interval | The interval to poll the git repository and ref for changes | 30s | v2.0.0 | +| storage.[id].ca_cert_bytes | The CA certificate bytes for the remote URL | | v2.0.0 | +| storage.[id].ca_cert_path | The CA certificate path for the remote URL | | v2.0.0 | +| storage.[id].insecure_skip_tls | Skip verifying the server's certificate chain (avoid in production) | false | v2.0.0 | +| storage.[id].fetch_policy | Policy for handling connection issues when fetching from remote Git (strict, lenient) | strict | v2.3.0 | +| storage.[id].credentials | The id of the credentials to use for the remote URL | | v2.0.0 | #### Commit Signing diff --git a/docs/v2/configuration/storage.mdx b/docs/v2/configuration/storage.mdx index 7daa31a..3ed9de4 100644 --- a/docs/v2/configuration/storage.mdx +++ b/docs/v2/configuration/storage.mdx @@ -79,6 +79,7 @@ storage: remote: "https://github.com/flipt-io/example.git" branch: "main" poll_interval: "30s" + fetch_policy: "strict" credentials: "github" backend: type: memory @@ -86,6 +87,41 @@ storage: This configuration will create a git storage backend with the identifier `staging` in memory and will sync flag state to and from the remote repository. +### Fetch Policy + +The `fetch_policy` configuration option controls how Flipt handles connection-related issues when attempting to fetch from a remote Git repository. + +#### Available Policies + +- **`strict`** (default): Flipt will fail and return an error if it encounters connection issues when trying to fetch from the remote repository. This ensures that any connectivity problems are immediately visible and must be resolved. + +- **`lenient`**: Flipt will continue operating even if connection issues prevent fetching from the remote repository. This allows Flipt to remain functional during temporary network issues or remote repository unavailability. + +#### Usage Example + +```yaml +storage: + production: + remote: "https://github.com/company/flags.git" + fetch_policy: "strict" # Fail fast on connection issues + backend: + type: local + path: "/var/lib/flipt" + + development: + remote: "https://github.com/company/flags.git" + fetch_policy: "lenient" # Continue operation during connection issues + backend: + type: memory +``` + + + In production environments, consider using `strict` to ensure that + connectivity issues are detected and resolved promptly, preventing potential + configuration drift between your remote repository and running Flipt + instances. + + ### Conflict Resolution Conflicts can occur when syncing flag state to and from a remote repository. The conflict resolution strategy in Flipt v2 is currently rudimentary and we aim to improve this in future releases.