@mstoduto/gatsby-source-remote-config
v1.0.2
Published
Gatsby source plugin for building websites using the Remote Config as a data source
Downloads
5
Maintainers
Readme
gatsby-source-remote-config
Gatsby plugin for connecting Firebase Remote Config as a data source.
Usage
Generate and download a Firebase Admin SDK private key by accessing the Firebase Project Console > Settings > Service Accounts
Rename and put the downloaded
.json
crendtial file somewhere in the GatsbyJS project (e.g../credentials.json
)Add
gatsby-source-remote-config
as a dependency by running usingnpm
oryarn
:npm i @mstoduto/gatsby-source-remote-config # or yarn add @mstoduto/gatsby-source-remote-config
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 |