JSON in Environmental Variable on Netlify The 2019 Stack Overflow Developer Survey Results Are InHow to recover a dropped stash in Git?How to stop tracking and ignore changes to a file in Git?How do I clone into a non-empty directory?Read environment variables in Node.jsHow to change the remote a branch is tracking?How to access environment variable values?How do I delete an exported environment variable?Untrack files from git temporarilyBranch specific environment variables on NetlifyUploading local subfolder to deploy on Netlify?

Springs with some finite mass

Is this food a bread or a loaf?

Falsification in Math vs Science

Is bread bad for ducks?

Does a dangling wire really electrocute me if I'm standing in water?

Why is my p-value correlated to difference between means in two sample tests?

Does light intensity oscillate really fast since it is a wave?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

How long do I have to send payment?

Why is it "Tumoren" and not "Tumore"?

I looked up a future colleague on LinkedIn before I started a job. I told my colleague about it and he seemed surprised. Should I apologize?

How to make payment on the internet without leaving a money trail?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

Why can Shazam do this?

Why isn't airport relocation done gradually?

Why is the maximum length of OpenWrt’s root password 8 characters?

Are there any other methods to apply to solving simultaneous equations?

Where to refill my bottle in India?

Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?

Inflated grade on resume at previous job, might former employer tell new employer?

How to reverse every other sublist of a list?

Why is Grand Jury testimony secret?

Is flight data recorder erased after every flight?

Why did Howard Stark use all the Vibranium they had on a prototype shield?



JSON in Environmental Variable on Netlify



The 2019 Stack Overflow Developer Survey Results Are InHow to recover a dropped stash in Git?How to stop tracking and ignore changes to a file in Git?How do I clone into a non-empty directory?Read environment variables in Node.jsHow to change the remote a branch is tracking?How to access environment variable values?How do I delete an exported environment variable?Untrack files from git temporarilyBranch specific environment variables on NetlifyUploading local subfolder to deploy on Netlify?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am building an AWS Lambda function that uses ServiceAccountKey.json for Firebase authentication. When deploying to Netlify, I don't want to expose this data in the git repo. Is there a way I can save the whole JSON as an environmental variable?



JSON in environmental variable



Environmental variables on Netlify










share|improve this question






























    0















    I am building an AWS Lambda function that uses ServiceAccountKey.json for Firebase authentication. When deploying to Netlify, I don't want to expose this data in the git repo. Is there a way I can save the whole JSON as an environmental variable?



    JSON in environmental variable



    Environmental variables on Netlify










    share|improve this question


























      0












      0








      0








      I am building an AWS Lambda function that uses ServiceAccountKey.json for Firebase authentication. When deploying to Netlify, I don't want to expose this data in the git repo. Is there a way I can save the whole JSON as an environmental variable?



      JSON in environmental variable



      Environmental variables on Netlify










      share|improve this question
















      I am building an AWS Lambda function that uses ServiceAccountKey.json for Firebase authentication. When deploying to Netlify, I don't want to expose this data in the git repo. Is there a way I can save the whole JSON as an environmental variable?



      JSON in environmental variable



      Environmental variables on Netlify







      git firebase deployment environment-variables netlify






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 9:37







      Robert Wolf

















      asked Mar 8 at 8:26









      Robert WolfRobert Wolf

      442310




      442310






















          2 Answers
          2






          active

          oldest

          votes


















          1














          If I'm not wrong, you can store the json in the env var as a simple string.
          Otherwise have a look a jq which allows you to run to read a json from a file and directly store it in an env var.



          Regards,






          share|improve this answer






























            2














            disclaimer: I work for Netlify's Support team.



            While the prior suggestion that JSON can be used as a string without carriage returns embedded might work, it can be a bit challenging to get an environment variable to contain quote characters, which all non-trivial JSON I've ever seen uses. Two different suggestions to do this differently:



            1. to create the string with a placeholder instead and during build replace the placeholders with quotes. I use the @ character in this example, so your "JSON" would look like {@type@: @service_account..., and then you could use something like this in your build:

            echo -e "$JSON_VARIABLE//@/"" > file.json && do_your_normal_build



            1. you could also create a function (documentation here: https://www.netlify.com/docs/functions/) that returns it and that would even provide a reasonable Content-Type HTTP response header if needed.





            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059286%2fjson-in-environmental-variable-on-netlify%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              If I'm not wrong, you can store the json in the env var as a simple string.
              Otherwise have a look a jq which allows you to run to read a json from a file and directly store it in an env var.



              Regards,






              share|improve this answer



























                1














                If I'm not wrong, you can store the json in the env var as a simple string.
                Otherwise have a look a jq which allows you to run to read a json from a file and directly store it in an env var.



                Regards,






                share|improve this answer

























                  1












                  1








                  1







                  If I'm not wrong, you can store the json in the env var as a simple string.
                  Otherwise have a look a jq which allows you to run to read a json from a file and directly store it in an env var.



                  Regards,






                  share|improve this answer













                  If I'm not wrong, you can store the json in the env var as a simple string.
                  Otherwise have a look a jq which allows you to run to read a json from a file and directly store it in an env var.



                  Regards,







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 8 at 9:48









                  tagkillertagkiller

                  1815




                  1815























                      2














                      disclaimer: I work for Netlify's Support team.



                      While the prior suggestion that JSON can be used as a string without carriage returns embedded might work, it can be a bit challenging to get an environment variable to contain quote characters, which all non-trivial JSON I've ever seen uses. Two different suggestions to do this differently:



                      1. to create the string with a placeholder instead and during build replace the placeholders with quotes. I use the @ character in this example, so your "JSON" would look like {@type@: @service_account..., and then you could use something like this in your build:

                      echo -e "$JSON_VARIABLE//@/"" > file.json && do_your_normal_build



                      1. you could also create a function (documentation here: https://www.netlify.com/docs/functions/) that returns it and that would even provide a reasonable Content-Type HTTP response header if needed.





                      share|improve this answer



























                        2














                        disclaimer: I work for Netlify's Support team.



                        While the prior suggestion that JSON can be used as a string without carriage returns embedded might work, it can be a bit challenging to get an environment variable to contain quote characters, which all non-trivial JSON I've ever seen uses. Two different suggestions to do this differently:



                        1. to create the string with a placeholder instead and during build replace the placeholders with quotes. I use the @ character in this example, so your "JSON" would look like {@type@: @service_account..., and then you could use something like this in your build:

                        echo -e "$JSON_VARIABLE//@/"" > file.json && do_your_normal_build



                        1. you could also create a function (documentation here: https://www.netlify.com/docs/functions/) that returns it and that would even provide a reasonable Content-Type HTTP response header if needed.





                        share|improve this answer

























                          2












                          2








                          2







                          disclaimer: I work for Netlify's Support team.



                          While the prior suggestion that JSON can be used as a string without carriage returns embedded might work, it can be a bit challenging to get an environment variable to contain quote characters, which all non-trivial JSON I've ever seen uses. Two different suggestions to do this differently:



                          1. to create the string with a placeholder instead and during build replace the placeholders with quotes. I use the @ character in this example, so your "JSON" would look like {@type@: @service_account..., and then you could use something like this in your build:

                          echo -e "$JSON_VARIABLE//@/"" > file.json && do_your_normal_build



                          1. you could also create a function (documentation here: https://www.netlify.com/docs/functions/) that returns it and that would even provide a reasonable Content-Type HTTP response header if needed.





                          share|improve this answer













                          disclaimer: I work for Netlify's Support team.



                          While the prior suggestion that JSON can be used as a string without carriage returns embedded might work, it can be a bit challenging to get an environment variable to contain quote characters, which all non-trivial JSON I've ever seen uses. Two different suggestions to do this differently:



                          1. to create the string with a placeholder instead and during build replace the placeholders with quotes. I use the @ character in this example, so your "JSON" would look like {@type@: @service_account..., and then you could use something like this in your build:

                          echo -e "$JSON_VARIABLE//@/"" > file.json && do_your_normal_build



                          1. you could also create a function (documentation here: https://www.netlify.com/docs/functions/) that returns it and that would even provide a reasonable Content-Type HTTP response header if needed.






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 8 at 20:43









                          foolfool

                          1,365817




                          1,365817



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059286%2fjson-in-environmental-variable-on-netlify%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              1928 у кіно

                              Захаров Федір Захарович

                              Ель Греко