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

feat: add NKEYs and JWT auth #27

Merged
merged 2 commits into from
Oct 27, 2023
Merged
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
11 changes: 11 additions & 0 deletions spawnpoint.nats.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ module.exports = require('spawnpoint').registerPlugin({
config.connection.name += ` node@${process.version}`;
}

// Setup an authenticator if available
if(config.connection.auth) {
// We want to read in the creds file given to us
const authCredsFile = path.join(app.cwd, config.connection.auth.creds_file);
delete config.connection.auth.creds_file;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is redundant as I delete the entire object on line 65 but included just in-case.

const authCreds = fs.readFileSync(authCredsFile);
// Create a new credsAuthenticator
config.connection.authenticator = nats.credsAuthenticator(authCreds);
delete config.connection.auth;
}

const helpers = {
wrapMessageError(error) {
if(error?.code === nats.ErrorCode.NoResponders) {
Expand Down
Loading