
This glance service follows the same pattern as the keystone service, and provides both version negotiation and endpoint discovery. Unlike the keystone service, however, it is configured using an endpoint configuration object as discovered from the Keystone service catalog. Change-Id: I0fe2bc9690022688e2cb80b9ca1b10bcea86c13d
26 lines
615 B
JavaScript
26 lines
615 B
JavaScript
/*eslint no-process-env: "off" */
|
|
import fs from 'fs';
|
|
import karma from 'karma/lib/config';
|
|
import path from 'path';
|
|
|
|
function getDevstackConfig() {
|
|
const karmaConfig = karma.parseConfig(path.resolve('./karma.conf.js'));
|
|
|
|
return getCorsConfig('$KEYSTONE_CONF', karmaConfig) +
|
|
getCorsConfig('$GLANCE_API_CONF', karmaConfig);
|
|
|
|
}
|
|
|
|
function getCorsConfig(service, karmaConfig) {
|
|
return `[[post-config|${service}]]
|
|
[cors]
|
|
allowed_origin=http://localhost:${karmaConfig.port}
|
|
`;
|
|
}
|
|
|
|
fs.appendFile(process.env.BASE + '/new/devstack/local.conf', getDevstackConfig(), (err) => {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
});
|