Skip to content

Commit

Permalink
Merge pull request #27 from nodecraft/feat/nkeys-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherry committed Oct 27, 2023
2 parents 8c99078 + 6b0db95 commit 4ec318f
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);
// 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 4ec318f

Please sign in to comment.