Skip to content

loadEnv Issue with 'GHOST_CONTENT_API_KEY' #4

@vreddy-in

Description

@vreddy-in

Hi there,

When trying to use the API key from .env file, i saw this error "GHOST_CONTENT_API_KEY is required in your .env file to use this loader".
It works fine when this is passed in config.ts collection function "__DO_NOT_USE_TESTING_ONLY__GHOST_CONTENT_API_KEY".

Upon investigating, i found that vite uses the prefix to filter the data in .env file.
So, i used this custom prefix and it works for me.
const env = loadEnv("all", process.cwd(), 'GHOST_');

I don't know how it would work for others, pls investigate further and add this support.

Thanks a lot for your ghostcms-loader module, it works well alongside other content collections(I'm not a web developer btw).

Thanks,
Vinay

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions