<p>It is convenient to use Environment Variables to provide runtime configuration for such scripts. Especially when it contains secrets that you don't want to hold in any persistent storage or in version control.</p>

<p>When you do actually have secrets, it is even better to use some kind of secret management system that will provide these secrets on request. One such tool that I highly recommend is HashiCorp's Vault.</p>

<p>Depending on how you are executing the jobs on the Bamboo Server, another option might be to store a local file on the server and reference that during builds. This is not really recommended since the server then becomes a special snowflake that only a few people know how to actually set up. It is much better to allow malfunctions with the server, or even the loss of all server data, to not affect your ability to deploy code. Thus having special files on the server itself is not so great.</p>

CC BY-SA 3.0
2018-01-08T20:58:09.490Z
I want to avoid storing the config file on disk for the very reason you stated.

I've been using Environment Variables in the past, but that specific deployment project takes in quite a big json file with different settings, mostly secrets. I was considering just outputting the the configuration in an inline json format and assigning it to an Environment Variable, but that gets quite messy to edit..
DemoBytom
CC BY-SA 3.0
2018-01-08T22:22:58.557Z
HashiCorp Vault to the rescue!
Evgeny Zislis
CC BY-SA 3.0
2018-01-08T20:47:44.737Z
2018-01-08T20:47:44.737Z
Evgeny Zislis
<p>One of the steps in our deployment process requires a configuration file that we don't want to commit to the repository and rather have it passed in by the Bamboo itself. Is there some sort of task/way to conveniently add it? It can be either a task that creates a file in work directory or assigns the file content to a variable.</p>

<p>What we want to avoid is to have the file on the disk and passing in the path to the file - I'd rather have a way of pasting the file directly into a task.</p>

<p>Currently, the deployment step calls a script that expects the content of said config file to be passed in (shortened for brevity):</p>

<p><code>deploy.ps1 --settings=&lt;file_content&gt;</code></p>

<p>edit:
The settings file is a lengthy json file, with several arrays on few levels. I've been considering just assigning an inlined content of that file to the environment variable, but I was wondering if there was a better way to pass it as well as allow maintainers edit the values, if necessary.</p>

<p>Splitting the config into several Bamboo environment variables is not really feasable, especially since one of our use cases requires the ability to run the deployment script without Bamboo, in case of server failure, for example.</p>

<deployment><bamboo>
Passing in a file with configuration
DemoBytom
# Passing in a file with configuration

(Asked by: username_0 on 2018-01-08)

One of the steps in our deployment process requires a configuration file that we don't want to commit to the repository and rather have it passed in by the Bamboo itself. Is there some sort of task/way to conveniently add it? It can be either a task that creates a file in work directory or assigns the file content to a variable.

What we want to avoid is to have the file on the disk and passing in the path to the file - I'd rather have a way of pasting the file directly into a task.

Currently, the deployment step calls a script that expects the content of said config file to be passed in (shortened for brevity):

`deploy.ps1 --settings=`

edit:
The settings file is a lengthy json file, with several arrays on few levels. I've been considering just assigning an inlined content of that file to the environment variable, but I was wondering if there was a better way to pass it as well as allow maintainers edit the values, if necessary.

Splitting the config into several Bamboo environment variables is not really feasable, especially since one of our use cases requires the ability to run the deployment script without Bamboo, in case of server failure, for example.

**Tags:** deployment, bamboo


---

## 1 answers

### Answer by username_1 on 2018-01-08. Score: 5

It is convenient to use Environment Variables to provide runtime configuration for such scripts. Especially when it contains secrets that you don't want to hold in any persistent storage or in version control.

When you do actually have secrets, it is even better to use some kind of secret management system that will provide these secrets on request. One such tool that I highly recommend is HashiCorp's Vault.

Depending on how you are executing the jobs on the Bamboo Server, another option might be to store a local file on the server and reference that during builds. This is not really recommended since the server then becomes a special snowflake that only a few people know how to actually set up. It is much better to allow malfunctions with the server, or even the loss of all server data, to not affect your ability to deploy code. Thus having special files on the server itself is not so great.

> **Comments:**
> **username_0**: I want to avoid storing the config file on disk for the very reason you stated.  I've been using Environment Variables in the past, but that specific deployment project takes in quite a big json file with different settings, mostly secrets. I was considering just outputting the the configuration in an inline json format and assigning it to an Environment Variable, but that gets quite messy to edit..  
> **username_1**: HashiCorp Vault to the rescue!  

---

