Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom path does not support variables #52

Closed
andidev opened this issue Apr 2, 2020 · 3 comments · Fixed by #106
Closed

custom path does not support variables #52

andidev opened this issue Apr 2, 2020 · 3 comments · Fixed by #106

Comments

@andidev
Copy link

andidev commented Apr 2, 2020

for example this works for me:

path: .env.dev

but this does not

path: .env.${'dev'}
@SimonHoiberg
Copy link

+1 on this one.
I would love to be able to do something like this:

dotenv:
    path: 'deployment/${self:provider.stage}/.env'

@neverendingqs
Copy link
Owner

I think you might find more mileage with the built-in dotenv support? Unfortunately, it does not allow for custom paths - the dotenv file must live in the root directory of the project.

As noted in #38 (comment),

Variable references in the serverless instance are not resolved before a Plugin's constructor is called, so if you need these, make sure to wait to access those from your hooks.
~https://www.serverless.com/framework/docs/providers/aws/guide/plugins/#plugins/

. We do everything in the constructor today to try to be the first thing that happens when Serverless does its thing. However, that means. Serverless hasn't interpolated the values for us at that time.

There might be a way to trigger interpolation, but it might be via a non-public API, which isn't a great option.

Unfortunately, I do not have a workaround at time. Open to ideas!

@neverendingqs
Copy link
Owner

I thought about this more, and I think there are sufficient alternatives that I am comfortable closing this with wontfix. I added some workarounds in #106.

Please feel free to reopen if you have additional feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants