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

prefix env vars #189

Merged
merged 1 commit into from
Mar 14, 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
8 changes: 4 additions & 4 deletions backend/emails/emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const currencyFormatter = new Intl.NumberFormat('en-CA', {

const getEmailToSection = async (reporter_id, recipients) => {
const emailToSet = new Set(
process.env.EMAIL_RECIPIENTS?.split(',') || [
process.env.WATO_FINANCE_EMAIL_RECIPIENTS?.split(',') || [
'[email protected]',
'[email protected]',
'[email protected]',
Expand All @@ -42,7 +42,7 @@ const getEmailToSection = async (reporter_id, recipients) => {
}

if (recipients.includes(EMAIL_RECIPIENTS.finance)) {
// emailToSet.add(process.env.FINANCE_EMAIL)
// emailToSet.add(process.env.WATO_FINANCE_FINANCE_EMAIL)
}

if (recipients.includes(EMAIL_RECIPIENTS.reporter)) {
Expand Down Expand Up @@ -122,9 +122,9 @@ const getTicketLinkHTML = (ticketPath) => `
<p>
View the ticket here:
<a
href=${process.env.CLIENT_URL}${ticketPath}
href=${process.env.WATO_FINANCE_CLIENT_URL}${ticketPath}
>
${process.env.CLIENT_URL}${ticketPath}
${process.env.WATO_FINANCE_CLIENT_URL}${ticketPath}
</a>
</p>
`
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/files.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const upload = multer({
storage: multerS3({
s3: s3Client,
contentType: multerS3.AUTO_CONTENT_TYPE,
bucket: process.env.AWS_FINANCE_BUCKET_NAME,
bucket: process.env.WATO_FINANCE_AWS_FINANCE_BUCKET_NAME,
storageClass: 'STANDARD_IA',
metadata: function (req, file, cb) {
cb(null, {
Expand Down
4 changes: 2 additions & 2 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const mongoose = require('mongoose')
require('dotenv').config()

const app = express()
const port = process.env.PORT || 5000
const port = process.env.WATO_FINANCE_PORT || 5000

app.use(cors())
app.use(express.json())

const uri = process.env.ATLAS_URI
const uri = process.env.WATO_FINANCE_ATLAS_URI
mongoose.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true,
Expand Down
4 changes: 2 additions & 2 deletions backend/service/files.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getAllFilesByReference = async (reference) => {
files.map(async (file) => {
// generate a presigned url for each file
const presignedUrl = await generatePresignedUrl(
process.env.AWS_FINANCE_BUCKET_NAME,
process.env.WATO_FINANCE_AWS_FINANCE_BUCKET_NAME,
getS3FileKey(file.reference_code, file.name)
)
return {
Expand Down Expand Up @@ -78,7 +78,7 @@ const deleteFile = async (referenceCode, fileName) => {
// first delete from s3 first, as its ok to have orphaned files in mongo (no cost) since we only store metadata
// then delete from db
await deleteS3File(
process.env.AWS_FINANCE_BUCKET_NAME,
process.env.WATO_FINANCE_AWS_FINANCE_BUCKET_NAME,
getS3FileKey(referenceCode, fileName)
)
return File.findOneAndDelete({
Expand Down
6 changes: 3 additions & 3 deletions backend/service/sendEmail.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Mailjet = require('node-mailjet')

const mailjet = Mailjet.apiConnect(
process.env.MAILJET_API_KEY,
process.env.MAILJET_SECRET_KEY
process.env.WATO_FINANCE_MAILJET_API_KEY,
process.env.WATO_FINANCE_MAILJET_SECRET_KEY
)

const sendEmail = async ({ To, Subject, HTMLPart }) => {
Expand All @@ -11,7 +11,7 @@ const sendEmail = async ({ To, Subject, HTMLPart }) => {
Messages: [
{
From: {
Email: process.env.FINANCE_EMAIL,
Email: process.env.WATO_FINANCE_FINANCE_EMAIL,
},
To,
Subject,
Expand Down
3 changes: 2 additions & 1 deletion backend/utils/seedData.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const numFundingItemsToCreatePerSponsorshipFund = 2
const numPersonalPurchasesToCreatePerFundingItem = 2
const numUWFinancePurchasesToCreatePerFundingItem = 2

const backend_url = process.env.BACKEND_URL || 'http://localhost:5000'
const backend_url =
process.env.WATO_FINANCE_BACKEND_URL || 'http://localhost:5000'

const lorem = new LoremIpsum({
wordsPerSentence: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/axiosConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from 'axios'
import app from './firebase'
import { getAuth } from 'firebase/auth'
export const axiosPreset = axios.create({
baseURL: `${process.env.REACT_APP_BACKEND_URL}`,
baseURL: `${process.env.REACT_APP_WATO_FINANCE_BACKEND_URL}`,
})

// dont have access to currentuser at axiosPreset creation, so append on at request time
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/contexts/AuthContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const AuthProvider = ({ children }) => {
const identifier = searchWithEmail ? userEmail : userWatiam

const retrievedGroup = await axiosPreset.get(
`${process.env.REACT_APP_BACKEND_URL}/googlegroups/${identifier}`
`${process.env.REACT_APP_WATO_FINANCE_BACKEND_URL}/googlegroups/${identifier}`
)
setCurrentUserGroup(retrievedGroup?.data?.title)

Expand Down
12 changes: 6 additions & 6 deletions frontend/src/firebase.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { initializeApp } from 'firebase/app'

const firebaseConfig = {
apiKey: process.env.REACT_APP_API_KEY,
authDomain: process.env.REACT_APP_AUTH_DOMAIN,
projectId: process.env.REACT_APP_PROJECT_ID,
storageBucket: process.env.REACT_APP_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID,
appId: process.env.REACT_APP_APP_ID,
apiKey: process.env.REACT_APP_WATO_FINANCE_API_KEY,
authDomain: process.env.REACT_APP_WATO_FINANCE_AUTH_DOMAIN,
projectId: process.env.REACT_APP_WATO_FINANCE_PROJECT_ID,
storageBucket: process.env.REACT_APP_WATO_FINANCE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_WATO_FINANCE_MESSAGING_SENDER_ID,
appId: process.env.REACT_APP_WATO_FINANCE_APP_ID,
}

const app = initializeApp(firebaseConfig)
Expand Down
Loading