Skip to content

Commit

Permalink
Merge pull request #725 from desci-labs/enforce-envs
Browse files Browse the repository at this point in the history
enforce env flags and vars temporarily
  • Loading branch information
shadrach-tayo authored Dec 17, 2024
2 parents 770fa6c + 3a31ee9 commit 1507cad
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion desci-server/kubernetes/deployment_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
export ELASTIC_SEARCH_USER="{{ .Data.ELASTIC_SEARCH_USER }}"
export ELASTIC_SEARCH_PW="{{ .Data.ELASTIC_SEARCH_PW }}"
export OPEN_ALEX_DATABASE_URL="{{ .Data.OPEN_ALEX_DATABASE_URL }}"
CLOUDFLARE_WORKER_API=nodes-dev-sync.desci.com
CLOUDFLARE_WORKER_API=https://nodes-dev-sync.desci.com
CLOUDFLARE_WORKER_API_SECRET=auth-token
ENABLE_WORKERS_API=true
export DEBUG_TEST=0;
Expand Down
2 changes: 1 addition & 1 deletion desci-server/kubernetes/deployment_prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
export ELASTIC_SEARCH_USER="{{ .Data.ELASTIC_SEARCH_USER }}"
export ELASTIC_SEARCH_PW="{{ .Data.ELASTIC_SEARCH_PW }}"
export OPEN_ALEX_DATABASE_URL="{{ .Data.OPEN_ALEX_DATABASE_URL }}"
CLOUDFLARE_WORKER_API=nodes-sync.desci.com
CLOUDFLARE_WORKER_API=https://nodes-sync.desci.com
CLOUDFLARE_WORKER_API_SECRET=auth-token
ENABLE_WORKERS_API=true
export IGNORE_LINE=0;
Expand Down
2 changes: 1 addition & 1 deletion desci-server/kubernetes/deployment_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ spec:
export ELASTIC_SEARCH_USER="{{ .Data.ELASTIC_SEARCH_USER }}"
export ELASTIC_SEARCH_PW="{{ .Data.ELASTIC_SEARCH_PW }}"
export OPEN_ALEX_DATABASE_URL="{{ .Data.OPEN_ALEX_DATABASE_URL }}"
CLOUDFLARE_WORKER_API=nodes-sync.desci.com
CLOUDFLARE_WORKER_API=https://nodes-sync.desci.com
CLOUDFLARE_WORKER_API_SECRET=auth-token
ENABLE_WORKERS_API=true
export DEBUG_TEST=0;
Expand Down
6 changes: 3 additions & 3 deletions desci-server/src/services/repoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { NodeUuid } from './manifestRepo.js';

const logger = parentLogger.child({ module: 'Repo Service' });

const cloudflareWorkerApi = process.env.CLOUDFLARE_WORKER_API;
const cloudflareWorkerApiSecret = process.env.CLOUDFLARE_WORKER_API_SECRET;
const enableWorkersApi = process.env.ENABLE_WORKERS_API == 'true';
const cloudflareWorkerApi = 'https://nodes-dev-sync.desci.com'; // process.env.CLOUDFLARE_WORKER_API;
const cloudflareWorkerApiSecret = 'auth-token'; // process.env.CLOUDFLARE_WORKER_API_SECRET;
const enableWorkersApi = true; // process.env.ENABLE_WORKERS_API == 'true';

type ApiResponse<B> = { ok: boolean } & B;

Expand Down
2 changes: 1 addition & 1 deletion desci-server/test/integration/automerge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const createDraftNode = async (user: User, baseManifest: ResearchObjectV1, baseM
return { node: updatedNode || node, documentId: response?.documentId };
};

describe.only('Automerge Integration', () => {
describe('Automerge Integration', () => {
let user: User;
let unauthedUser: User;
// let node: Node;
Expand Down
2 changes: 1 addition & 1 deletion desci-server/test/integration/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const createDraftNode = async (user: User, baseManifest: ResearchObjectV1, baseM
return { node: updatedNode || node, documentId: response?.documentId };
};

describe.only('Data Controllers', () => {
describe('Data Controllers', () => {
let user: User;
let unauthedUser: User;
// let node: Node;
Expand Down
2 changes: 1 addition & 1 deletion sync-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ async function getLatestDocument(request: Request, env: Env) {

export default {
fetch(request: Request, env) {
const secretKey = env.ENVIRONMENT === null ? 'test-api-secret' : env.API_TOKEN;
console.log('Request Fetch:', {
env,
url: request.url,
});
const secretKey = env.ENVIRONMENT === null ? 'test-api-secret' : env.API_TOKEN;
if (request.url.includes('/api/') && request.headers.get('x-api-key') != secretKey) {
console.log('[Error]::Api key error');
return new Response('UnAuthorized', { status: 401 });
Expand Down

0 comments on commit 1507cad

Please sign in to comment.