/** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // rootURL in production equals `{{.ContentPath}}` and therefore is replaced // with the value of -ui-content-path. During development rootURL uses the // value as set in environment.js const read = require('fs').readFileSync; const hbsRe = /{{(@[a-z]*)}}/g; const hbs = (path, attrs = {}) => read(`${process.cwd()}/app/components/${path}`) .toString() .replace('{{yield}}', '') .replace(hbsRe, (match, prop) => attrs[prop.substr(1)]); const BrandLoader = (attrs) => hbs('brand-loader/index.hbs', attrs); const Enterprise = (attrs) => hbs('brand-loader/enterprise.hbs', attrs); module.exports = ({ appName, environment, rootURL, config, env }) => ` ${BrandLoader({ color: '#8E96A3', width: config.CONSUL_BINARY_TYPE !== 'oss' && config.CONSUL_BINARY_TYPE !== '' ? `394` : `198`, subtitle: config.CONSUL_BINARY_TYPE !== 'oss' && config.CONSUL_BINARY_TYPE !== '' ? Enterprise() : ``, })} ${ environment === 'development' || environment === 'staging' ? ` ` : `` } ${ environment === 'production' ? ` {{if .ACLsEnabled}} {{end}} {{if .PeeringEnabled}} {{end}} {{if .PartitionsEnabled}} {{end}} {{if .NamespacesEnabled}} {{end}} {{if .HCPEnabled}} {{end}} ` : ` ` } ${environment === 'test' ? `` : ``} ${ environment === 'production' ? `{{ range .ExtraScripts }} {{ end }}` : `` } ${environment === 'test' ? `` : ``} `;