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

(WIP) Remove undocumented ST2_AUTH_TOKEN from st2chatops #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 1 addition & 11 deletions scripts/stackstorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ env.ST2_WEBUI_URL = env.ST2_WEBUI_URL || null;
env.ST2_AUTH_USERNAME = env.ST2_AUTH_USERNAME || null;
env.ST2_AUTH_PASSWORD = env.ST2_AUTH_PASSWORD || null;

// Optional authentication token
env.ST2_AUTH_TOKEN = env.ST2_AUTH_TOKEN || null;

// Optional API key
env.ST2_API_KEY = env.ST2_API_KEY || null;

Expand Down Expand Up @@ -153,8 +150,6 @@ module.exports = function(robot) {

if (env.ST2_API_KEY) {
api.setKey({ key: env.ST2_API_KEY });
} else if (env.ST2_AUTH_TOKEN) {
api.setToken({ token: env.ST2_AUTH_TOKEN });
}

function authenticate() {
Expand All @@ -165,11 +160,6 @@ module.exports = function(robot) {
robot.logger.info('Using ST2_API_KEY as authentication. Expiry will lead to bot exit.');
return Promise.resolve();
}
// Auth token gets precedence 2
if (env.ST2_AUTH_TOKEN) {
robot.logger.info('Using ST2_AUTH_TOKEN as authentication. Expiry will lead to bot exit.');
return Promise.resolve();
}

robot.logger.info('Requesting a token...');

Expand Down Expand Up @@ -197,7 +187,7 @@ module.exports = function(robot) {
});
}

if (env.ST2_API_KEY || env.ST2_AUTH_TOKEN || env.ST2_AUTH_USERNAME || env.ST2_AUTH_PASSWORD) {
if (env.ST2_API_KEY || env.ST2_AUTH_USERNAME || env.ST2_AUTH_PASSWORD) {
// If using username and password then all are required.
if ((env.ST2_AUTH_USERNAME || env.ST2_AUTH_PASSWORD) &&
!(env.ST2_AUTH_USERNAME && env.ST2_AUTH_PASSWORD && env.ST2_AUTH_URL)) {
Expand Down