Skip to content

Commit

Permalink
more cors updates. selective api deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Apr 3, 2024
1 parent fdeeb72 commit 4021932
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,37 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
changed_files:
name: Determine changed files
runs-on: ubuntu-latest
outputs:
api: ${{ steps.api.outputs.any_changed }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get API changed files
id: api
uses: tj-actions/changed-files@v23
with:
since_last_remote_commit: true
files: |
**/server/src/**/*.ts
**/server/package.json
**/packages/apps/src/**/*.ts
**/packages/db/src/**/*.ts
**/packages/error/**/*.ts
**/packages/libraries/**/*.ts
**/apps/gnocchi/scanning/**/*.ts
./Dockerfile
./fly.toml
./pnpm-lock.yaml
build-and-push-image:
name: Build and push Docker image
runs-on: ubuntu-latest
needs: [changed_files]
if: ${{ needs.changed_files.outputs.api == 'true' }}
permissions:
contents: read
packages: write
Expand Down
5 changes: 5 additions & 0 deletions server/src/config/cors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { appIds, apps } from '@biscuits/apps';
import { UI_ORIGIN } from './deployedContext.js';
import { URL } from 'url';

const uiOriginWithWWW = new URL(UI_ORIGIN);
uiOriginWithWWW.hostname = `www.${uiOriginWithWWW.hostname}`;

export const ALLOWED_ORIGINS = [
'http://localhost:6123',
UI_ORIGIN,
uiOriginWithWWW.toString(),
// old apps - allowed for transfer purposes
'https://gnocchi.club',
'https://www.gnocchi.club',
Expand Down

0 comments on commit 4021932

Please sign in to comment.