diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c11ea93d5..9aa92b1c6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,6 +48,8 @@ jobs: api_location: ".output/server" # Api source code path - optional output_location: ".output/public" # Built app content directory - optional ###### End of Repository/Build Configurations ###### + env: + DATABASE_URL: ${{ secrets.AZURE_TEST_DATABASE_URL }} - name: Run API tests run: yarn test:api --env-var='base_url=${{ steps.builddeploy.outputs.static_web_app_url }}/api' @@ -121,8 +123,6 @@ jobs: api_location: ".output/server" # Api source code path - optional output_location: ".output/public" # Built app content directory - optional ###### End of Repository/Build Configurations ###### - env: - NODE_ENV: "build" - name: Run API tests run: yarn test:api --env-var='base_url=${{ matrix.url }}/api' diff --git a/config.ts b/config.ts index 4a400c3b2..ecd38412b 100644 --- a/config.ts +++ b/config.ts @@ -38,6 +38,10 @@ function enumFromStringValue( } function getEnvironment(): Environment { + if (process.env.INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN) { + return Environment.AzureBuild + } + // Github always sets CI variable https://docs.github.com/en/actions/learn-github-actions/environment-variables if (process.env.CI) { return Environment.CI diff --git a/package.json b/package.json index 06733169a..0b50a76f3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "nuxi dev", "build": "nuxi build --fail-on-error", - "build:azure": "NITRO_PRESET=azure yarn build", + "build:azure": "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN=test NITRO_PRESET=azure yarn build", "start": "nuxi preview", "start:azure": "NUXT_PUBLIC_ENVIRONMENT=development npx @azure/static-web-apps-cli start .output/public --api-location .output/server", "generate": "yarn prisma:generate && yarn graphql:generate", diff --git a/server/utils/crypto.spec.ts b/server/utils/crypto.spec.ts index 7ade46adf..5dfa9a174 100644 --- a/server/utils/crypto.spec.ts +++ b/server/utils/crypto.spec.ts @@ -21,4 +21,13 @@ describe('verifyHash', () => { const hashedPassword = await hash('password') expect(await verifyHash('different', hashedPassword)).toBe(false) }) + + it('returns true for the password of alice', async () => { + expect( + await verifyHash( + 'EBNPXY35TYkYXHs', + '19184d8c1c1e9b483d8347f8da0d53ad92170233100d32c3a0d748725948c28d09a060d7f02962b7b93320c72a2cdd94f21b16b08bf8bd1cba0c5f77afeffddbb24df527c4f16f1fca6eb5480159b56df3d818b4b3c74ead04227a78b3d810b8' + ) + ).toBe(true) + }) }) diff --git a/server/utils/services.factory.ts b/server/utils/services.factory.ts index fbcb010dc..6541d4613 100644 --- a/server/utils/services.factory.ts +++ b/server/utils/services.factory.ts @@ -45,7 +45,13 @@ export async function createRedisClient(): Promise< delete redisConfig.password } const client = redis.createClient(redisConfig) - await client.connect() + try { + await client.connect() + } catch (exception) { + console.error('Error while connection to redis') + console.error(redisConfig) + throw exception + } return client } }