-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow config.json for options #7
Comments
Hello @dbhowell, do you have any guide or tips how to do it? I wouldn't want to expose my aws access id and keys on my repository if I do something like:
so far it is working with this setup but I don't know how to set it up so my credentials are not exposed in the repo. Thanks a lot. |
I also tried doing something like this, but it's not working:
const { exec } = require('child_process');
require('dotenv').config();
exec(
`pino-cloudwatch --aws_access_key_id=${
process.env.AWS_CLOUDWATCH_ACCESS_ID
} --aws_secret_access_key=${process.env.AWS_CLOUDWATCH_ACCESS_KEY} --aws_region=${
process.env.AWS_CLOUDWATCH_REGION
} --group=${process.env.AWS_CLOUDWATCH_LOG_GROUP_NAME}`,
(err, stdout, stderr) => {
if (err) {
console.log(err);
// node couldn't execute the command
return;
}
// the *entire* stdout and stderr (buffered)
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
},
);
start: "cross-env NODE_ENV=dev nodemon bin/dev | node cloudwatch.js" |
Hi @arvi , sorry if you've already tried this but if you omit the |
Hello @dbhowell, It's okay now after n attempts 😅, I finally figure out how not to expose it without having to set my environment variables one by one before start script e.g I used Sharing my implementation just in case others wouldn't want to expose their "scripts": {
"start": "better-npm-run build:dev",
},
"betterScripts": {
"build:dev":
"DEBUG=dbg:* cross-env NODE_ENV=dev nodemon bin/dev | pino-cloudwatch --aws_access_key_id=${AWS_CLOUDWATCH_ACCESS_ID} --aws_secret_access_key=${AWS_CLOUDWATCH_ACCESS_KEY} --aws_region=${AWS_CLOUDWATCH_REGION} --group=${AWS_CLOUDWATCH_LOG_GROUP_NAME}"
}, Thanks for your work on |
I'm glad you got around it. Would it help if pino-cloudwatch used |
Hello @dbhowell I created a pull request wherein user can also choose loading credentials from config.json or shared ini credentials. I have tried my forked package with these changes and both options are working as expected. With regards to your |
This would be great. I need this in my project :-) |
@ulver2812 , I already created a pull request of that feature. However, it is not yet pushed by the author. What I did for the meantime is use another npm package called "scripts": {
"start": "better-npm-run build:dev",
},
"betterScripts": {
"build:dev": {
"command": "DEBUG=dbg:* nodemon bin/dev | pino-cloudwatch --aws_access_key_id=${AWS_CLOUDWATCH_ACCESS_ID} --aws_secret_access_key=${AWS_CLOUDWATCH_ACCESS_KEY} --aws_region=${AWS_CLOUDWATCH_REGION} --group=${AWS_CLOUDWATCH_LOG_GROUP_NAME} --prefix=${AWS_CLOUDWATCH_PREFIX}",
"env": {
"NODE_ENV": "development"
}
},
}, the AWS config are on my .env file 😄 |
I found another way without using an extra package such as
One inconvenient of this method is that the time the child process starts, I miss some logs. Did not test yet what happens if the child process fails. |
No description provided.
The text was updated successfully, but these errors were encountered: