white-balloon-205
salmon-account-74572
05/10/2019, 9:05 PMaws.ec2.Instance
are of type Input. How does one take the result of a function like aws.getAmi
(which is a Promise, AIUI) and use it to specify a value for a property?orange-tailor-85423
05/10/2019, 10:18 PMorange-tailor-85423
05/10/2019, 10:19 PMorange-tailor-85423
05/10/2019, 10:19 PMorange-tailor-85423
05/10/2019, 10:21 PMpulumi up
to generate our config. So far I’ve got a pre-commit hook:orange-tailor-85423
05/10/2019, 10:21 PMorange-tailor-85423
05/10/2019, 10:21 PMorange-tailor-85423
05/10/2019, 10:21 PMorange-tailor-85423
05/10/2019, 10:22 PMorange-tailor-85423
05/10/2019, 10:22 PMorange-tailor-85423
05/10/2019, 10:22 PMorange-tailor-85423
05/10/2019, 10:23 PMorange-tailor-85423
05/10/2019, 10:24 PMorange-tailor-85423
05/10/2019, 10:26 PMorange-tailor-85423
05/10/2019, 10:27 PMorange-tailor-85423
05/10/2019, 10:29 PMglamorous-printer-66548
05/11/2019, 5:33 AMc
or any other single character 😄. It just makes reading the code harder even if it’s somewhat clear from the surrounding context what the c stands for (but consumes more brain CPU :-P). In your example I would call this variable configFileName
instead.
2. You can turn import fs = require('fs');
into import * as fs from 'fs'
. Just looks more ES6 native 😉
Coming to your actual problem: In line 15 you’re loading the merged config by calling require(‘config’). This will load the merged config based on your environment variables during the first .forEach loop iteration. However in the second loop iteration - despite you having changed the environment variables - the require('config')
call will return exactly the same thing as in the first one. In general in node.js multiple calls of require(‘asdf’) will always return the exact same thing (this also applies to ES6 imports import ... from 'asdf'
for that matter). This is described in further detail here: https://nodejs.org/api/modules.html#modules_caching .
I haven’t tried it out myself but it looks like you should be able to use https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities#loadfileconfigsdirectory (e.g. require('config').util.loadFileConfigs(path.join(__dirname, 'config'))
instead of the plain require('config')
to load the merged config without experiencing the caching problem.few-dog-41530
05/15/2019, 3:49 PMfew-dog-41530
05/15/2019, 3:49 PMfew-dog-41530
05/15/2019, 3:50 PMwhite-balloon-205
few-dog-41530
05/15/2019, 3:58 PMfew-dog-41530
05/15/2019, 3:59 PMwhite-balloon-205
few-dog-41530
05/15/2019, 4:03 PMpulumi up
locallyfew-dog-41530
05/15/2019, 4:04 PMnpm 404 error: cannot find @org/private...
few-dog-41530
05/15/2019, 4:05 PMfew-dog-41530
05/15/2019, 4:10 PMnpm_modules
folder and try to install locally againfew-dog-41530
05/15/2019, 4:14 PM