mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Configurable shield credentials for tests
While there are still hardcoded defaults, this change allows people to specify custom credentials via environment variables for each shield role in our tests.
This commit is contained in:
parent
4e71bee3e6
commit
d50c48bccb
3 changed files with 25 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
|||
var shield = require('./shield');
|
||||
|
||||
var kibanaURL = '/app/kibana';
|
||||
|
||||
module.exports = {
|
||||
|
@ -11,13 +13,13 @@ module.exports = {
|
|||
protocol: process.env.TEST_UI_KIBANA_PROTOCOL || 'http',
|
||||
hostname: process.env.TEST_UI_KIBANA_HOSTNAME || 'localhost',
|
||||
port: parseInt(process.env.TEST_UI_KIBANA_PORT, 10) || 5620,
|
||||
auth: 'user:notsecure'
|
||||
auth: shield.kibanaUser.username + ':' + shield.kibanaUser.password
|
||||
},
|
||||
elasticsearch: {
|
||||
protocol: process.env.TEST_UI_ES_PROTOCOL || 'http',
|
||||
hostname: process.env.TEST_UI_ES_HOSTNAME || 'localhost',
|
||||
port: parseInt(process.env.TEST_UI_ES_PORT, 10) || 9220,
|
||||
auth: 'admin:notsecure'
|
||||
auth: shield.admin.username + ':' + shield.admin.password
|
||||
}
|
||||
},
|
||||
apps: {
|
||||
|
|
16
test/shield.js
Normal file
16
test/shield.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const env = process.env;
|
||||
|
||||
exports.kibanaUser = {
|
||||
username: env.SHIELD_KIBANA_USER || 'user',
|
||||
password: env.SHIELD_KIBANA_USER_PASS || 'notsecure'
|
||||
};
|
||||
|
||||
exports.kibanaServer = {
|
||||
username: env.SHIELD_KIBANA_SERVER || 'kibana',
|
||||
password: env.SHIELD_KIBANA_SERVER_PASS || 'notsecure'
|
||||
};
|
||||
|
||||
exports.admin = {
|
||||
username: env.SHIELD_ADMIN || 'admin',
|
||||
password: env.SHIELD_ADMIN_PASS || 'notsecure'
|
||||
};
|
|
@ -1,6 +1,7 @@
|
|||
import { defaultsDeep, set } from 'lodash';
|
||||
import requirefrom from 'requirefrom';
|
||||
import { header as basicAuthHeader } from './base_auth';
|
||||
import { kibanaUser, kibanaServer } from '../shield';
|
||||
|
||||
const src = requirefrom('src');
|
||||
const KbnServer = src('server/KbnServer');
|
||||
|
@ -26,8 +27,8 @@ const SERVER_DEFAULTS = {
|
|||
},
|
||||
elasticsearch: {
|
||||
url: 'http://localhost:9210',
|
||||
username: 'kibana',
|
||||
password: 'notsecure'
|
||||
username: kibanaServer.username,
|
||||
password: kibanaServer.password
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -46,7 +47,8 @@ export function createServer(params = {}) {
|
|||
* Creates request configuration with a basic auth header
|
||||
*/
|
||||
export function authOptions() {
|
||||
const authHeader = basicAuthHeader('user', 'notsecure');
|
||||
const { username, password } = kibanaUser;
|
||||
const authHeader = basicAuthHeader(username, password);
|
||||
return set({}, 'headers.Authorization', authHeader);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue