silverwolf-x's picture
download
raw
815 Bytes
import { ConfigPlugin, JssConfig } from "..";
/**
* This plugin will set config props based on scjssconfig.json.
* scjssconfig.json may not exist if you've never run `jss setup` (development)
* or are depending on environment variables instead (production).
*/
class ScJssConfigPlugin implements ConfigPlugin {
order = 1;
async exec(config: JssConfig) {
let scJssConfig;
try {
scJssConfig = require("scjssconfig.json");
} catch (e) {
return config;
}
if (!scJssConfig) return config;
return Object.assign({}, config, {
sitecoreApiKey: config.sitecoreApiKey || scJssConfig.sitecore?.apiKey,
sitecoreApiHost:
config.sitecoreApiHost || scJssConfig.sitecore?.layoutServiceHost,
});
}
}
export const scjssconfigPlugin = new ScJssConfigPlugin();

Xet Storage Details

Size:
815 Bytes
·
Xet hash:
0276193e7ea915cfddec120cdf4ac69b6a3b2f62d023a39cacb248cfdc6228b4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.