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

feat: support adding static files to Edge Functions #3045

Merged
merged 5 commits into from
Jan 15, 2025

Conversation

laktek
Copy link
Contributor

@laktek laktek commented Jan 15, 2025

What kind of change does this PR introduce?

This PR introduces a new config static_files, which can be defined per function in config.toml. This can be used to add static files (eg: HTML, WASM) to Edge Functions.

Eg:

[functions.serve-html]
static_files = [ "functions/serve-html/*.html" ]

Which can then be read in Edge Function, like:

const file = await Deno.readTextFile(new URL("foo.html", import.meta.url))

@laktek laktek requested a review from a team as a code owner January 15, 2025 03:39
@laktek laktek force-pushed the support-static-flag branch from 095d4c1 to 8d74a76 Compare January 15, 2025 03:49
@coveralls
Copy link

coveralls commented Jan 15, 2025

Pull Request Test Coverage Report for Build 12789317426

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 15 (40.0%) changed or added relevant lines in 5 files are covered.
  • 82 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.08%) to 58.365%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/functions/deploy/bundle.go 2 4 50.0%
pkg/config/config.go 1 3 33.33%
pkg/function/bundle.go 2 4 50.0%
internal/functions/serve/serve.go 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/config/secret.go 3 94.44%
internal/debug/postgres.go 3 64.86%
internal/gen/keys/keys.go 5 12.9%
pkg/config/config.go 71 52.17%
Totals Coverage Status
Change from base Build 12772880210: -0.08%
Covered Lines: 7577
Relevant Lines: 12982

💛 - Coveralls

Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

Generally ok, commented on some edge cases

@sweatybridge sweatybridge changed the title Support adding static files to Edge Functions feat: support adding static files to Edge Functions Jan 15, 2025
@sweatybridge sweatybridge merged commit fb0cd15 into develop Jan 15, 2025
9 checks passed
@sweatybridge sweatybridge deleted the support-static-flag branch January 15, 2025 14:10
@github-actions github-actions bot mentioned this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants