Passing JSON File to Stack Script

I would like to pass a JSON file, or more specifically a JSON formatted string, to a StackScript to pass a large amount of configuration information, including some sensitive keys. I know environment variables on linux can have a 32k size limit and for my configuration, that would suffice, so theoretically I can copy-pasta the JSON contents into a UDF field when launching the StackScript. But that doesn't seem like the best way to do this. I don't want to host the file on a open web server given the various keys in the file. What would you say is the best approach to do what I am trying to do? I don't mind using linode-cli, but it seems to have the same environment variable issues.

1 Reply

There are two main ways to pass data to a StackScript, and you mentioned both of them in your post. The first would be to paste the string directly into the StackScript. That said, if you plan to make the StackScript public, anyone using the StackScript will be able to view this string. Since you mentioned that it contains sensitive keys, this may not be the best option. If you plan to keep the StackScript private, this may not be as big of a concern. The second option is to keep the file on a separate server. Object Storage is a good fit for hosting these types of files. Depending on the script, you may be able to make use of signed URLs or bucket policies to restrict access to the file when the StackScript is not in use. You could also consider password-protecting the file and passing the login information with wget, depending on the intended privacy settings of your StackScript.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct