Skip to content

prebid/currency-file-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

currency-file-generator

Loads currency rates from a reliable source and creates, uploads a JSON representation to S3, and pushes the file to the currency-file github repo.

The S3 file is published to http://currency.prebid.org/latest.json. The github file is hosted at https://cdn.jsdelivr.net/gh/prebid/currency-file@1/latest.json.

Install

$ git clone https://github.com/prebid/currency-file-generator.git
$ cd currency-file-generator
$ npm install

Test

$ npm run test

AWS Lambda Config

  • src/currencyRatesFileGen.js - File
  • currencyRatesFilesGen.handler - Handler

To install in AWS Lambda

  1. Get the login/password from someone who has it
  2. Update lambda function prebidCurrencyRatesFileAlerter from src/prebidCurrencyRatesFileAlerter.js
  3. To update the prebidCurrencyRatesFileGenerator lambda:
    1. clone the git repo and make/test your changes locally
    2. copy src/currencyRatesFileGen.js src/ajax.js src/shell.js to the top level of your local repo dir
    3. the test node_modules aren't needed, so rm -rf node_modules and npm install --production
    4. zip -r currency-gen.zip currencyRatesFileGen.js ajax.js shell.js serverless.yml node_modules
    5. aws s3 cp currency-gen.zip s3://currency-generation-code
    6. go to the AWS lambda UI and upload https://s3.amazonaws.com/currency-generation-code/currency-gen.zip
    7. in Basic settings make sure that Handler is set to currencyRatesFileGen.downloadPublish
    8. in AWS lambda UI add a corresponding layer that provides git support from https://github.com/lambci/git-lambda-layer (arn:aws:lambda:us-east-1:553035198032:layer:git-lambda2:7 as of now)
    9. make sure the environment variables are set correctly
    10. remove currencyRatesFileGen.js, ajax.js, and shell.js from the top level of your local repo dir

Note that you'll want to raise the timeout to 1.5 minutes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published