diff --git a/README.md b/README.md index 8c10e59c..8aa56079 100644 --- a/README.md +++ b/README.md @@ -179,4 +179,19 @@ firebase deploy --only database:prod # For production - **Version Control**: Use version control to track changes and collaborate on rule development. - **Testing**: Thoroughly test your rules in a development or staging environment before deploying to production. -Review the [Firebase CLI documentation](https://firebase.google.com/docs/cli) for more details on managing project resources. \ No newline at end of file +Review the [Firebase CLI documentation](https://firebase.google.com/docs/cli) for more details on managing project resources. + + +## Hosting on github and Authentication + +When hosting the application in a new place there are a couple of things to update. + +- You must add your new domain to the allowed list for authenication in firebase. + https://console.firebase.google.com/u/0/project/cioos-metadata-form/authentication/settings + https://console.firebase.google.com/u/0/project/cioos-metadata-form-dev/authentication/settings + +- You have to allow your domain under Website restrictions for the firebase browser key + https://console.cloud.google.com/apis/credentials/key/405d637a-efd4-48f5-95c6-f0af1d7f4889?project=cioos-metadata-form + https://console.cloud.google.com/apis/credentials/key/23d360a3-4b55-43f2-bc1c-b485371c0e07?project=cioos-metadata-form-dev + + \ No newline at end of file diff --git a/cioos-records-update/README.md b/cioos-records-update/README.md index 89bd9e7a..a5d9b1b0 100644 --- a/cioos-records-update/README.md +++ b/cioos-records-update/README.md @@ -2,4 +2,7 @@ This is a basic Flask app to create XML from the metadata form -Requires `key.json` +Requires `key.json` which contains a service account key json +specifically one from [here](https://console.cloud.google.com/iam-admin/serviceaccounts/details/108735728189650899572/keys?authuser=0&hl=en&project=cioos-metadata-form) you can also generate one [here](https://console.firebase.google.com/u/0/project/cioos-metadata-form/settings/serviceaccounts/adminsdk) + +Alternatively the same service account key json string can be specified in the FIREBASE_SERVICE_ACCOUNT_KEY environment variable. The app will look for the environment variable first and fall back to the key.json file if ot found. diff --git a/firebase-functions/functions/updates.js b/firebase-functions/functions/updates.js index 3d3d2e96..3d6c2256 100644 --- a/firebase-functions/functions/updates.js +++ b/firebase-functions/functions/updates.js @@ -1,8 +1,11 @@ const functions = require("firebase-functions"); +const { defineString } = require('firebase-functions/params'); const https = require("https"); const axios = require("axios"); -const urlBase = "https://pac-dev1.cioos.org/cioos-xml/"; +const generatorURL = defineString('RECORD_GENERATOR_URL'); +const urlBase = process.env.RECORD_GENERATOR_URL || generatorURL.value() || "https://pac-dev1.cioos.org/cioos-xml/"; + function getRecordFilename(record) { return `${record.title[record.language].slice(