Skip to content

NODE_ENV development has no effect on cleanEnv env.isDev leading to https scheme being used for URLs on localhost #951

@timwaters

Description

@timwaters

When running kutt locally in development mode all generated URLs have the https scheme instead of http e.g. https://localhost:3000/abc123

Setting NODE_ENV in an environment variable has no effect.

cleanEnv env.isDev will be false and so the code to check env.isDev in server/utils/utils.js getSiteURL() and getShortURL() will return "https"

I think this was due to commit 91ea35f which removed how it set the process.env.NODE_ENV to development or production.
edits: However I suspect it's due to "start": "node server/server.js --production", in package.json

Following the readme in envalid perhaps NODE_ENV needs to be in the spec const, but just undoing the above commit made isDev work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions