ember-remote-json

0.1.1 • Public • Published

NOTICE: WORK IN PROGRESS

Ember-remote-json

Utilizes the ember-cli preBuild hook, to load config files from s3 or http endpoints and store them locally. Useful for configs or any type of data you would like to "bake" into the app, before the build process starts

Installation

npm install ember-remote-json

AWS Credentials

If you want to fetch files from S3 then you must provide the necessary AWS API credentials provided in your environment variables:

AWS_KEY=[your AWS key]
AWS_SECRET=[your AWS secret]

Build process integration

In your Brocfile.js modify the app initialisation like so:

var app = new EmberApp({
    babel: {
        nonStandard: false, // remove JSX support
        optional: [
            'es7.asyncFunctions',
        ]
    },
    remoteJson: {
        AWS_BUCKET: [bucket name],
        AWS_FILES: `file1.json:file2.json:file3.json`,
        plainHttp: [
            {
                src: 'https://example.com/somefile.json',
                dest: 'filename.json'
            }
        ],
        ER_DEST_DIR: [destination dir e.g 'app/json'],
        ER_DISABLED: [if you want to disable (for example in dev mode) set this flag to true]
    }
});

The script will split your the files you've included in AWS_FILES based on :. Make sure you don't give your files any weird names or this will explode. The files will be written in the ER_DEST_DIR.

Enjoy - PRs always welcome, tests not there yet

Readme

Keywords

Package Sidebar

Install

npm i ember-remote-json

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • alexloi