You have more options to set the configuration values in order of preference:
- Create a config.json file and add the file path as parameter for the module.
- Define configurations as environment variables.
- Use pre-defined fallback values.
Every setting has a default fallback value.
FOLIO_HOST - Hostname of OKAPI
FOLIO_PORT - Port of OKAPI
FOLIO_PROTOCOL - Protocol of OKAPI
FOLIO_TENANT - Tenant id
FOLIO_USERNAME - Username for authentication
FOLIO_PASSWORD - Password for username
FOLIO_FILENAME - File name with user data
FOLIO_PAGESIZE - Number of users to search for in one query
FOLIO_LOGFILE - Log file for user import
Use module in a script
var folioUserImport = require('folio-user-import');
folioUserImport();
optional parameter: configuration JSON file name
Run code locally
cd folio-user-import
npm install
npm start
- Login to FOLIO with credentials set in the configuration values.
- Get list of address types.
- Get list of patron groups.
- Read user data from the configured JSON file.
- Query FOLIO if users already exist in the system (in batch of
FOLIO_PAGESIZEnumber of users) - Decide by the result of the query if the current user have to be inserted or updated in the system.
- Update existing users.
- Create non-existing users. Assign empty permission list to user.