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;
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?
git firebase deployment environment-variables netlify
add a comment |
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?
git firebase deployment environment-variables netlify
add a comment |
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?
git firebase deployment environment-variables netlify
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?
git firebase deployment environment-variables netlify
git firebase deployment environment-variables netlify
edited Mar 8 at 9:37
Robert Wolf
asked Mar 8 at 8:26
Robert WolfRobert Wolf
442310
442310
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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,
add a comment |
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:
- 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
- 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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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,
add a comment |
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,
add a comment |
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,
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,
answered Mar 8 at 9:48
tagkillertagkiller
1815
1815
add a comment |
add a comment |
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:
- 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
- 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.
add a comment |
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:
- 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
- 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.
add a comment |
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:
- 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
- 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.
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:
- 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
- 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.
answered Mar 8 at 20:43
foolfool
1,365817
1,365817
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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