Lambda function that fetches data from KSG-Met and stores it on an S3 bucket.
To install dependencies run:
npm installIn order to include to dev dependencies:
npm install --saveDevTo build the zip file for Lambda, run one of the following two commands.
If on a POSIX system:
npm run-script build-aws-resourceIf on Windows:
npm run-script build-aws-resource-winFor Lambda, a zip containing the following files will be created:
index.js- the
src/directory node_modules/directorypackage.jsonLICENSE
The zip file will be put into the dest folder.
In order to run manually outside of Lambda run:
node manual_run.jsThis above the downloader without the Lambda handler.
Configuration is read from environment variables. It can be provide by an .env file placed in the working directory.
The following configuration variables are supported:
SERVER_URL- base url of the serverPL_CSV_PATH- path to the poland CSV directory,prognozy/CSV/polandby defaultPL_CSV_STEP- step used to the determine the next hour value to pull from, by default1. Applies to Poland CSV.PL_CSV_FETCH_HOURS- how many hours of Poland CSV data to fetch (maps to directory paths). Default is40.PL_CSV_ERROR_LIMIT- how many 404 errors to tolerate and retry by going lower. Default is0. Applies to Poland CSV.EU_LONG_CSV_PATH- path to the Europe long CSV directory,prognozy/CSV/europe_longby defaultEU_LONG_CSV_STEP- step used to the determine the next hour value to pull from, by default3. Applies to Europe long CSV.EU_LONG_CSV_FETCH_HOURS- how many hours of Europe long CSV data to fetch (maps to directory paths). Default is168.EU_LONG_CSV_ERROR_LIMIT- how many 404 errors to tolerate and retry by going lower. Default is3. Applies to Europe long CSV.PL_CACHE_PATH- path to Poland cache directory. Default isprognozy/CACHE/poland.LOG_LEVEL- Winston logging level, default isinfo.UPLOAD_TO_S3- whether to upload data to S3. By defaultfalse.LOAD_AWS_CONFIG_FILE: - whether to load aws configuration from.aws-config.json.S3_BUCKET_NAME- the name of the S3 bucket to upload to
In order to run jasmine unit tests, execute:
npm run-script test