@mstoduto/gatsby-source-remote-config

1.0.2 • Public • Published

gatsby-source-remote-config npm node

Gatsby plugin for connecting Firebase Remote Config as a data source.

Usage

  1. Generate and download a Firebase Admin SDK private key by accessing the Firebase Project Console > Settings > Service Accounts

  2. Rename and put the downloaded .json crendtial file somewhere in the GatsbyJS project (e.g. ./credentials.json)

  3. Add gatsby-source-remote-config as a dependency by running using npm or yarn:

    npm i @mstoduto/gatsby-source-remote-config
    # or
    yarn add @mstoduto/gatsby-source-remote-config
  4. Configure settings at gatsby-config.js, for example:

module.exports = {
    plugins: [
        {
            resolve: `@mstoduto/gatsby-source-remote-config`,
            options: {
                // credential or appConfig
                credential: require(`./credentials.json`),
                appConfig: {
                    apiKey: 'api-key',
                    authDomain: 'project-id.firebaseapp.com',
                    databaseURL: 'https://project-id.firebaseio.com',
                    projectId: 'project-id',
                    storageBucket: 'project-id.appspot.com',
                    messagingSenderId: 'sender-id',
                    appID: 'app-id',
                },
                parameterGroup: "website",
                fields: [
                    "sections"
                ]
            },
        },
    ],
};

Example

{
  allRemoteConfigParam {
    nodes {
      id
      valueString
      value {
        array {
          content
          order
          title
        }
      }
    }
  }
}

Configurations

Key Description
credential Credential configurations from downloaded private key
fields Array of fields to get from remote config
appConfig Credential configurations defined inside object
parameterGroup Name of the parameterGroup to use, if none only main folder parameters are shown

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i @mstoduto/gatsby-source-remote-config

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

6.36 kB

Total Files

3

Last publish

Collaborators

  • mstoduto