-
Notifications
You must be signed in to change notification settings - Fork 21
Parse .env vars to directory vars #335
Comments
Hi @angelhodar , thanks for opening this issue! Is your use case to migrate a I imagine adding an The command could look something like this:
Example: For your example, you'd use:
What do you think? I believe mapping the environment variables to a directory structure will be challenging. In your example the secret name |
Cool suggestion! +1 on the idea of making a For the underscore case you mention, we can do something interactive by adding an
Upon save (and exiting the editor) it would then proceed to write all those secrets to the paths specified by the user. Then by default the |
Hey @SimonBarendse, glad you like my idea, I find it very helpful for already existing .env files in a project, so people can easily migrate them to secrethub with just a few commands and be accesible for other team members. The problem of the underscores can be solved by specifying a -d/--deep option to let the user specify how many underscores are used as dirs. The default value could be 0, so each var in the .env file would be added as direct child of the specified dir, then a value of 1 would produce the output I showed in my first message, and a value of 2 would output this:
But i prefer the idea of @mackenbach, as its much more robust and makes the env vars naming of the user completely independent from the import command. In fact it could be done the reverse way, for example parse a secrethub dir to a -env file for a working project that uses an already configured package like dotenv, so secrethub can be used just once to configure the env files to start using the project. Just imagine you start a project and you add .env files and configure it in your project, then you migrate them to a dir in secrethub, invite a team member and just using the import command that team member would receive the .env files, everything secure. I have had this situation with a team mate, we used Telegram to pass .env files and this would be much more elegant and secure 👍 It would be somehow an alternative to secrethub run, somehow... |
Yes, this is exactly the kind of use case we're aiming to solve with SecretHub. It should be both easier and more secure to share your secrets. Do you know about You can read more about it here: https://secrethub.io/docs/reference/cli/run/#environment-files Bonus: you can define template variables in the We could add to the Alternatively, your colleagues could use the Are you proposing to get the |
My proposal was more in the direction of using secrethub as a way to pass env vars between team mates faster and without the need of using secrethub specific files or commands ( |
Would adding this to your { "scripts" :
{ "start" : "secrethub run --var env=${NODE_ENV} -- node server.js"
}
} Then your colleagues will just run This becomes even easier when we have the CLI as npm package as proposed in this ticket: #27. Then you can add SecretHub as a dev dependency to your project so that your colleagues will have it automatically. |
Hey there, so I have been reading the documentation and I havent found a way to dump a list of variables already set in my .env file as childs of a secrets directory in my account. There is an option called -i but this dumps a full .env file in one child, but I am talking about adding each variable of the file as child in the tree, either considering some tree structure from the var names (it would be the reverse implementation of the proposal in #286) or just add each var as direct child. It could be added as a --dump option in the write command:
Example
would map to
What do you think?
The text was updated successfully, but these errors were encountered: