refactor: 💡 Use env variables to set locize (#1299)
Instead of relying in dynamic configuration, use dedicated env variables to set locize api key / configuration Closes: #1271
This commit is contained in:
1 parent
ded2e61913
commit
756f70cc54
2 files changed
+14
-8
No files matched your search
@@ -29,19 +29,20 @@ function addLocales(newLocales) {
|
||||
customDebug(resourceBundle, 'info');
|
||||
}
|
||||
|
||||
// Note: Developers can add the API key to use the in-context editor.
|
||||
// DO NOT commit the API key
|
||||
const config = (window.config && window.config.i18n) || {};
|
||||
|
||||
/*
|
||||
* Note: Developers can add the API key to use the
|
||||
* in-context editor using environment variables.
|
||||
* (DO NOT commit the API key)
|
||||
*/
|
||||
const locizeOptions = {
|
||||
projectId: config.LOCIZE_PROJECTID,
|
||||
apiKey: config.LOCIZE_API_KEY,
|
||||
projectId: process.env.LOCIZE_PROJECTID,
|
||||
apiKey: process.env.LOCIZE_API_KEY,
|
||||
referenceLng: 'en-US',
|
||||
fallbacklng: 'en-US',
|
||||
};
|
||||
|
||||
const envUseLocize = !!config.USE_LOCIZE;
|
||||
const envApiKeyAvailable = !!config.LOCIZE_API_KEY;
|
||||
const envUseLocize = !!process.env.USE_LOCIZE;
|
||||
const envApiKeyAvailable = !!process.env.LOCIZE_API_KEY;
|
||||
const DEFAULT_LANGUAGE = 'en-US';
|
||||
|
||||
function initI18n(
|
||||
|
||||
Reference in new issue
Block a user