Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove problematic addition to workflow #14

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/CI and Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@ jobs:
with:
node-version: '20.x'
- run: npm ci
- run: npm install -g json-server
- run: json-server --watch db.json --routes routes.json --port 3000 &
- run: npm run build --if-present
- run: npm test
env:
DB_URL: ${{ secrets.DB_URL }}
NODE_ENV: 'production'
CLIENT_TOKEN: ${{ secrets.CLIENT_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
KANKA_TOKEN: ${{ secrets.KANKA_TOKEN }}
DB_TOKEN: ${{ secrets.DB_TOKEN }}
DB_URL: http://localhost:3000

deploy:
name: Fly Deploy
needs: build
Expand All @@ -34,3 +42,4 @@ jobs:
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
DB_URL: ${{ secrets.DB_URL}}
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import dotenv from 'dotenv';

dotenv.config();
if (process.env.NODE_ENV !== 'production') {
dotenv.config();
}

const { NODE_ENV, CLIENT_TOKEN, CLIENT_ID, KANKA_TOKEN, DB_TOKEN, DB_URL } = process.env;

Expand Down
8 changes: 8 additions & 0 deletions src/mocks/db/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"stats": [
{
"name": "EchoesLeft",
"value": 123
}
]
}
3 changes: 3 additions & 0 deletions src/mocks/db/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/stats?name=eq.EchoesLeft": "/stats/0"
}
2 changes: 1 addition & 1 deletion src/services/dbClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios, { AxiosRequestConfig, RawAxiosRequestHeaders } from 'axios';
import { config } from '../config';

export const dbClient = axios.create({
baseURL: config.DB_URL,
baseURL: process.env.NODE_ENV === 'test' ? 'http://localhost:3000' : config.DB_URL,
});

export const dbConfig: AxiosRequestConfig = {
Expand Down