functions

module
v0.0.0-...-9f83688 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2024 License: Apache-2.0

README

Dynamic functions on Krew documentation

Krew site makes use of Netlify Functions (lambdas) to fetch plugin list dynamically from krew-index repository using GitHub API.

Set up on Netlify

Functions require a one-time set up in the Netlify console.

Regarding GitHub API rate limits:

  • In production, make sure to set a GITHUB_ACCESS_TOKEN environment variable with a permissionless "personal access token" to elevate the rate limits for our functions.

    Dynamic responses from the functions are cached on Netlify’s CDN for a long time, so this is not a huge problem and a single token is very likely to suffice a long period of time.

  • During local development, you can hit the GitHub API rate limit as well. You should set the GITHUB_ACCESS_TOKEN environment variable as needed.

Local development

Start hugo local iteration server on port 1313:

cd ./site
hugo serve

In another terminal window, build and start the functions server on port 8080:

cd ./functions
go run ./server -port=8080

Now, you can reach the website at http://localhost:8080 and the functions at paths defined in the code e.g. http://localhost:8080/.netlify/functions/api/plugins.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL