Skip to content

Commit

Permalink
feat: add NKEYs and JWT auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mja00 committed Oct 23, 2023
1 parent 8c99078 commit f1a4457
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spawnpoint.nats.js
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;
const authCreds = fs.readFileSync(authCredsFile, 'utf8');
// 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

0 comments on commit f1a4457

Please sign in to comment.