mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
c8acf12d4f
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7635 GitOrigin-RevId: 5f4b24d30d39a2cf2c8eb4a0d0ccc60161389303
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
function config(entry = []) {
|
|
return [...entry, require.resolve('./src/lib/preset/preview')];
|
|
}
|
|
|
|
function managerEntries(entry = []) {
|
|
return [...entry, require.resolve('./src/lib/preset/manager')];
|
|
}
|
|
|
|
module.exports = {
|
|
config,
|
|
managerEntries,
|
|
previewBody: body => `
|
|
${body}
|
|
<script>
|
|
// Working as iframe and parent are on the same domain
|
|
const params = new URL(window.parent.location)?.searchParams;
|
|
let consoleType = 'oss';
|
|
let adminSecretSet = false;
|
|
|
|
const updateGlobals = () => {
|
|
if (params?.get('globals')) {
|
|
consoleType =
|
|
params
|
|
.get('globals')
|
|
.split(';')
|
|
.filter(global => global.includes('consoleType'))[0]
|
|
?.split(':')[1] || 'oss';
|
|
adminSecretSet =
|
|
params
|
|
.get('globals')
|
|
.split(';')
|
|
.filter(global => global.includes('adminSecretSet'))[0]
|
|
?.split(':')[1] === 'true';
|
|
}
|
|
|
|
window.__env = {
|
|
dataApiUrl: 'http://localhost:8080',
|
|
apiHost: 'http://localhost',
|
|
apiPort: '8080',
|
|
nodeEnv: 'development',
|
|
consoleType: consoleType === 'cloud-pro' ? 'cloud' : consoleType,
|
|
adminSecretSet,
|
|
adminSecret: adminSecretSet ? '*******' : null,
|
|
tenantID: consoleType === 'cloud-pro' ? 'tenant-id' : null,
|
|
};
|
|
};
|
|
|
|
updateGlobals();
|
|
</script>
|
|
`,
|
|
};
|