Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Option to use dotenv instead of assigning Environment Variables #225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_TINK_LINK_PAYMENT_CLIENT_ID=
TINK_LINK_PAYMENT_CLIENT_SECRET=
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these all the variables this project uses? Lets list them all so we have a better idea what needs to be setup prior to running it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After review, as this is a one-time payment, the only thing the client needs is the Client Id & Secret to create a session with Tink Link.

We could potentially parameterise something like the Product information, as it's hard coded a the moment. Which would mean the demo could be quickly repurposed via the config file, instead of changing server values.

  destinations: [
    {
      accountNumber: env.process.BANK_ACCOUNT_NUMBER,
      type: env.process.PAYMENT_TYPE
      reference: env.process.REFERENCE
    },
  ],
  recipientName: env.process.RECIPIENT_NAME
  sourceMessage: env.process.SOURCE_MESSAGE
  remittanceInformation: {
    type: env.process.RM_INFO_TYPE
    value: env.process.RM_INFO_VALUE
  },

Let me know your thoughts

Copy link
Contributor

@rtelicak rtelicak Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about moving all existing env variables in to this new .env variables, not creating a new ones. If REACT_APP_TINK_LINK_PAYMENT_CLIENT_ID and TINK_LINK_PAYMENT_CLIENT_SECRET is the only two, lets merge this.

cc: @shuma

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rtelicak thanks! I don't have merge perms still but happy to see this move forward!

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export REACT_APP_TINK_LINK_PAYMENT_CLIENT_ID='<YOUR_CLIENT_ID>'
export TINK_LINK_PAYMENT_CLIENT_SECRET='<YOUR_CLIENT_SECRET>'
```

(Alternatively, this can be done using the .env file found in the root of this project)

3. Run client and server in terminal separately

```
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@types/react-dom": "^16.9.7",
"@types/react-router-dom": "^5.1.7",
"body-parser": "^1.19.0",
"dotenv": "^16.0.0",
"express": "^4.17.1",
"node-fetch": "^2.6.1",
"react": "^17.0.1",
Expand Down
1 change: 1 addition & 0 deletions server/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fetch = require('node-fetch');
require('dotenv').config()

const CLIENT_ID = process.env.REACT_APP_TINK_LINK_PAYMENT_CLIENT_ID;
const CLIENT_SECRET = process.env.TINK_LINK_PAYMENT_CLIENT_SECRET;
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,11 @@ dotenv@8.2.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==

dotenv@^16.0.0:
version "16.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.0.tgz#c619001253be89ebb638d027b609c75c26e47411"
integrity sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==

duplexer@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
Expand Down