Create React App loads environment variables from [environment files](https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used)(<kbd>.env</kbd>, <kbd>.env.test</kbd>, etc.) according to the Node environment (`NODE_ENV`).
File <kbd>.env</kbd> is loaded in every environment with the lowest priority and is therefore used to declare default values and development fallbacks.
The following portal configuration variable is currently declared in <kbd>.env</kbd>:
The following portal configuration variables are declared in <kbd>.env</kbd>:
-`REACT_APP_ICATPLUS_URL` - the URL of the ICAT+ server (used in <kbd>src/config/icatPlus.js</kbd>)
-`REACT_APP_SSO_AUTH_ENABLED` - whether to allow users to sign-in to ICAT with SSO (used in <kbd>src/config/icat.js</kbd>)
-`REACT_APP_ANONYMOUS_AUTH_ENABLED` - whether to allow users to sign-in to ICAT as anonymous (used in <kbd>src/config/icat.js</kbd>)
-`REACT_APP_DB_AUTH_ENABLED` - whether to allow users to sign-in to ICAT with database credentials (used in <kbd>src/config/icat.js</kbd>)
In development, you can override this variable by creating a file called `.env.local`. This file is ignored from version control.
## icat.js
Edit the file **icat.js** with your favorite text editor and set the configuration to access the metadata catalogue following the indications below.
<!--START configurationICAT -->
```js
/**
* icat.example.js configuration file
*/
varICAT={
authentication:{
/** Single sign-on configuration */
sso:{
enabled:true,
/** ICAT authentication plugin for json web tokens */
plugin:'esrf',
/** Configuration to be passed to keycloak.js (https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/javascript-adapter.adoc) */
configuration:{
realm:'ESRF',
url:'https://websso.esrf.fr/auth/',
clientId:'icat',
},
},
/** Anonymous user's credentials*/
anonymous:{
enabled:true,
/** ICAT plugin used for authentication. */
plugin:'db',
/** Username for the anonymous user */
username:'reader',
/** Password for the anonymous user */
password:'reader',
},
authenticators:[
{
plugin:'esrf',
/** title will be displayed as the title of the Tab at the login Form */
title:'ESRF',
/** If will be hidden in the login form */
hidden:false,
},
{
plugin:'db',
title:'Database',
hidden:false,
},
],
},
};
exportdefaultICAT;
```
<!--END configurationICAT -->
In development, you can override any of these variables by creating a file called `.env.local`. This file is ignored from version control.
"doc":"npm run Readme:ConfigDoc:ICAT && npm run Readme:ConfigDoc:ICAT:ReplaceCodeSection && npm run Readme:ConfigDoc:ICATPlus && npm run Readme:ConfigDoc:ICATPlus:ReplaceCodeSection && npm run Readme:ConfigDoc:Config && npm run Readme:ConfigDoc:Config:ReplaceCodeSection",
/** ICAT authentication plugin for json web tokens */
enabled:process.env.REACT_APP_SSO_AUTH_ENABLED,
plugin:'esrf',
/** Configuration to be passed to keycloak.js (https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/javascript-adapter.adoc) */