tailcall
tailcall copied to clipboard
Read environmental variables from `.env` files
Is your feature request related to a problem? Please describe.
Most of the time we have a .env file in our directory that contains all the secret. Right now, there is no way to directly use this file to resolve the env keys in the mustache statement.
Describe the solution you'd like It would be nice to automatically detect and parse all environment variables in our mustache templates, rather than having to explicitely specifying them in our runtime environment.
Usage:
If we have a .env file with the following content in it,
API_ENDPOINT=myapi.com
Then, this block should work by default.
type Query {
users: [User]! @http(baseUrl: "{{env.API_ENDPOINT}}", path: "/users")
}
Agree. I suggested it when working on #790, but it was outside that issue's scope.
/bounty 120$
💎 $120 bounty created by tailcallhq
🙋 If you start working on this, comment /attempt #859 along with your implementation plan
👉 To claim this bounty, submit a pull request that includes the text /claim #859 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country. 💵 Payment arrives in your account 2-5 days after the bounty is rewarded. 💯 You keep 100% of the bounty award. 👍 If you go above and beyond by cleaning up or enhancing aspects beyond the scope of the PR, a tip may be awarded as a token of appreciation. 🙏 Thank you for contributing to tailcallhq/tailcall!. 🙋♂️ Join our discord channel if you need help.
👉 Add a bounty • Share on socials
| Attempt | Started (GMT+0) | Solution |
|---|---|---|
| 🔴 @ksh0205 | Jan 1, 2024, 11:02:30 AM | WIP |
/attempt #859
@ksh0205: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.
Hi @tusharmath, Can I give it a shot? Can you assign the issue to me.
I'd like to work on this one as I implemented part of the env thing already
I started working on it, and I'll use env-file-reader to read the env.
one question: Do we want a new operator or a new field on an existing operator?
IMO, we could add an env_file, env_path, or something like that on the @server operator or create an @env operator.
e.g.:
# new field on server operator
@server(env_path: ".env.something")
# OR
# new env operator
@env(path: ".env.something")
what do you think @tusharmath?
As discussed on Discord, we'll use @link for that, so we're blocked until #760 be resolved.
is this closed? I still this issue as open in algora
It's really open @Bhavyajain21. I'm assigned to this one but feel free to give it a shot if you want to
fixed in https://github.com/tailcallhq/tailcall/pull/1523