// Contributors by alliance role api.get('/v1/alliance/:role', handler((req, res) => { const roles = getRoles(req.params.role); roles.push('everything'); return _(utils.loadFile(contributorsFile)) .filter(person => !_.isEmpty(_.intersection(roles, lca(person.role)))) .values(); }));
_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()
_(services) // Break apart platform type into typ and version .map(service => _.merge({}, service, getPlatformServiceType(service))) // Filter out services that are not supported yet .filter(service => getLandoServiceType(service.type) !== false) // Merge in other needed lando things .map(service => _.merge({}, getLandoService(service), {runConfig: _.find(runConfig, {service: service.name})})) // Finally map to an object .map(service => ([service.name, service])) .fromPairs() .value()
// Helper to get tokens const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getTerminusTokens(home), tokens)) .map(token => ({name: token.email, value: token.token})) .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}])) .value()
_(process.env) // Only muck with prefix_ variables .pickBy((value, key) => _.includes(key, prefix)) // Prep the keys for consumption .mapKeys((value, key) => _.camelCase(_.trimStart(key, prefix))) // If we have a JSON string as a value, parse that and assign its sub-keys .mapValues(exports.tryConvertJson) // Resolve the lodash wrapper .value()
_(fs.readdirSync(baseDir, {withFileTypes: true})) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) .concat('.') .map(directory => path.resolve(baseDir, directory, '.platform.app.yaml')) .filter(file => fs.existsSync(file)) .map(file => ({data: yamlPlatform.load(fs.readFileSync(file)), file})) .map(data => ({name: data.data.name, file: data.file, dir: path.dirname(data.file)})) .value()
_(composeData) .flatMap(data => data.data) .flatMap(data => _.keys(data.services)) .uniq() .value()
_(apps) .map(app => app.relationships || []) .flatten() .thru(relationships => relationships[0]) .map((relationship, alias) => ({ alias, service: relationship.split(':')[0], endpoint: relationship.split(':')[1], creds: _.get(open, alias, {}), })) .groupBy('service') .value()
_(config.LANDO_METRICS_PLUGINS) .map(plugin => _.merge({}, plugin, {path: path.resolve(__dirname, 'plugins', `${plugin.name}.js`)})) .filter(plugin => fs.existsSync(plugin.path)) .map(plugin => _.merge({}, plugin, {Reporter: require(plugin.path)})) .value()
_(relationships) .map(relationship => relationship) .flatten() .map('service') .uniqBy() .value()
/* * Helper to find containers that serve */ const getOtherServingContainers = services => _(services) .filter(service => service.type === 'lagoon-varnish') .map('name') .value()
// Helper to get init config const getInitConfig = dirs => _(dirs) .filter(dir => fs.existsSync(dir)) .flatMap(dir => glob.sync(path.join(dir, '*', 'init.js'))) .map(file => require(file)) .value()
/* * Helper to get the applications environment variables */ const getEnvironmentVariables = appConfig => _(_.get(appConfig, 'variables.env', {})) .map((value, key) => ([key, (_.isObject(value)) ? JSON.stringify(value) : value])) .fromPairs() .value()
// Helper to get tokens const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getPlatformshTokens(home), tokens)) .map(token => ({name: token.email, value: token.token})) .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}])) .value()
_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()