Skip to content

feat: add support for using image config from next.config.js #518

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

Merged
merged 2 commits into from
Jul 12, 2021

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jul 12, 2021

Currently we require users to set an env var to specify allowed domains for images. This is because the next config is not available inside the function at runtime. This is not ideal from a DX perspective, but is particularly bad because of the fact that funcitons can only use env vars that have been set in the UI, not in the toml.

This PR instead writes a snapshot of the image config as a JSON file in the image function dir, while can then require() it. It still supports the env var for compatibility reasons, by merging any domains specified there. However it also emits a warning telling the user to switch to using the next.config.js instead.

Fixes #516

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jul 12, 2021
@ascorbic ascorbic requested a review from lindsaylevine July 12, 2021 13:45
Copy link

@lindsaylevine lindsaylevine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!

@ascorbic ascorbic merged commit bc7695d into main Jul 12, 2021
@ascorbic ascorbic deleted the fix/image-config-env branch July 12, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read image domains from next config
2 participants