Skip to content

Instantly share code, notes, and snippets.

@jobsamuel
Last active July 9, 2017 15:07
Show Gist options
  • Select an option

  • Save jobsamuel/ace5b9c4b167040e75e11acf978ddc8f to your computer and use it in GitHub Desktop.

Select an option

Save jobsamuel/ace5b9c4b167040e75e11acf978ddc8f to your computer and use it in GitHub Desktop.

Revisions

  1. jobsamuel revised this gist Jul 9, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions variable.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    const functions = require('firebase-functions');
    const admin = require('firebase-admin');

    // Aquí ocurre la magia de las variables de entorno:
    const token = functions.config().variable.key;

    exports.ejemploVariableDeEntorno = functions.https.onRequest((req, res) => {
  2. jobsamuel created this gist Jul 9, 2017.
    11 changes: 11 additions & 0 deletions variable.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    const functions = require('firebase-functions');
    const admin = require('firebase-admin');
    const token = functions.config().variable.key;

    exports.ejemploVariableDeEntorno = functions.https.onRequest((req, res) => {
    if (req.method === 'GET') {
    res.send(`Tu variable de entorno es ${token}`);
    } else {
    res.send(400).end();
    }
    });