Skip to content

Commit

Permalink
fix: cliamrc.js with env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-lebleu committed Feb 22, 2024
1 parent d5777e1 commit 97259e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Create a *.cliamrc.js* module on the root of your project.
> touch .cliamrc.js
```

:warning: It's strongly advised to:
- Add .cliamrc.js in your .gitignore file
- Use environment secrets to fill in sensible values like api keys. In this case, just npm i dotenv in your project, and require('doten').config() on the top of your .cliamrc.js file.

Define a minimalist configuration in *.cliamrc.js* newly created:

```javascript
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
import * as Dotenv from 'dotenv';

Dotenv.config();

import { Cliam } from './classes/cliam.class';

export { Cliam }
2 changes: 0 additions & 2 deletions test/00-bootstrap.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('dotenv').config();

const { copyFileSync } = require('fs');

copyFileSync(`${process.cwd()}/test/fixtures/cliamrc.js`, `${process.cwd()}/.cliamrc.js`);
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/cliamrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('dotenv').config();

module.exports = {
"sandbox": true,
"variables": {
Expand Down

0 comments on commit 97259e6

Please sign in to comment.