Skip to content

custom path does not support variables #52

Closed

Description

@andidev

for example this works for me:

path: .env.dev

but this does not

path: .env.${'dev'}

Activity

  1. SimonHoiberg commented on Jul 28, 2020

    @SimonHoiberg

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

    dotenv:
        path: 'deployment/${self:provider.stage}/.env'
  2. neverendingqs commented on Feb 6, 2021

    @neverendingqs
    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!

  3. neverendingqs commented on Feb 7, 2021

    @neverendingqs
    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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions