Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
simonbs
3 months agoNew Contributor
.env files should support more file formats
Hey, I was incredibly excited to see the 1Password beta supporting .env files. After testing it out in the latest beta, I understand that this is incredibly useful for environments that support trad...
1P_Phil
Moderator
3 months agoHi simonbs ,
Another great request, thank you for sharing this. It is helpful to know you are using 1Password in your development flow for iOS apps. I too used to develop iOS apps and can relate to your pain. From your note, it sounds like the request is to output different types of files that could be defined by a template and then the Environments feature would replace the secrets (like you mentioned like 'op inject' does from the command prompt).
Something like this:
1) Define a template file with 1Password URIs (could be swift, could be .env, or any other format, but basically a text file)
2) Create a new environment that knows about this template file (from #1) define the secrets linking to the URIs
3) Define a destination
4) Attempt to run a build process, that tries to access the destination from #2.
Let me know what you think.
Regards,
Phil & Team
- simonbs3 months agoNew Contributor
From your note, it sounds like the request is to output different types of files that could be defined by a template and then the Environments feature would replace the secrets (like you mentioned like 'op inject' does from the command prompt)
Yep, exactly. I think of the new .env support as writing secrets to a traditional .env template, but it could just as well be any other template, for example, one where secrets are written to a .swift file. If the .env feature of 1Password allowed us to supply our own template, similar to `op inject`, then this problem would be solved.
I'd love to test the flow you suggest, but I'm not sure I follow it. Here's what I've gathered so far:
- I think your bullet no. 1 is the `enum Secrets { ... }` that I have in my original post.
- In #2 I create an environment in 1Password with my secrets.However, from there, I'm unsure what to do. What's my destination in #3, and how do the secrets end up in my .swift file so I can access them at runtime in my app?
- 1P_Phil3 months ago
Moderator
Hi simonbs ,
Thanks for the continued input, I was thinking about this over last night, perhaps you could have a Production Environment flow using the AWS Secrets Sync outlet for your production app whereby the environment gets pushed up to AWS and then you access the secrets from the the production app through an API request.
If you have AWS as a backend, there are Swift APIs you can use to access the AWS Secret Manager.
Thanks,
Phil