Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
fix: environmental variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKanera committed Jan 4, 2021
1 parent e442502 commit 6477c9f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions components/my-project/my-project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ export default defineComponent({
const { title, description, links, mandatoryFiles, optionalFiles, submitted, deadlineDate, keywords } = response.data;
console.log(deadlineDate);
titleRef.value = title;
descriptionRef.value = description;
linksRef.value = links;
Expand Down
8 changes: 1 addition & 7 deletions env/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ const parseFirebaseConfig = () => {
};

const parseServiceAccount = () => {
if (process.client) return;
if (process.env.SERVICE_ACCOUNT) return JSON.parse(process.env.SERVICE_ACCOUNT as string);

console.error('Missing SERVICE_ACCOUNT environment variable');
};

const parseStorageServiceAccount = () => {
if (process.env.STORAGE_SERVICE_ACCOUNT) return JSON.parse(process.env.STORAGE_SERVICE_ACCOUNT as string);

console.error('Missing STORAGE_SERVICE_ACCOUNT environment variable');
};

export const env = {
firebaseConfig: parseFirebaseConfig(),
serviceAccount: parseServiceAccount(),
storageServiceAccount: parseStorageServiceAccount(),
};
2 changes: 0 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ const config: NuxtConfig = {
plugins: ['@/plugins/firebase.ts'],
env: {
FIREBASE_CONFIG: process.env.FIREBASE_CONFIG!,
SERVICE_ACCOUNT: process.env.SERVICE_ACCOUNT!,
STORAGE_SERVICE_ACCOUNT: process.env.STORAGE_SERVICE_ACCOUNT!,
TENANT: process.env.TENANT!,
},
firebase: {
Expand Down
2 changes: 1 addition & 1 deletion server/api/teacher/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async (req: Request, res: Response) => {
const userData = (await admin.firestore().collection('users').doc(userId).get()).data();

// User doesnt have current year set
if (!userData?.currentYear) return res.status(400).send();
if (!userData?.currentYear) return res.status(412).send();

// Teacher cant submit proposal
if (userData?.teacher) return res.status(403).send('Teacher cannot submit proposal');
Expand Down

0 comments on commit 6477c9f

Please sign in to comment.