Skip to content

Commit b78f1fe

Browse files
committed
Notes on private repos for templates, and custom template stores
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent d27a998 commit b78f1fe

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

docs/cli/templates.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ Before creating a new function make sure you pull in the official OpenFaaS langu
2828
$ faas-cli template pull
2929
```
3030

31+
Templates can also be pulled from custom repositories, for instance:
32+
33+
```bash
34+
$ faas-cli template pull https://github.com/openfaas/go-http-template
35+
```
36+
37+
For official templates, you will usually be able to pull them from the store, instead of having to remember various URLs. You'll find out more about the store on this page.
38+
39+
The `template pull` command uses your local Git client, so if you have proper authentication set up with a Git credential helper, then you'll also be able to run it against private repositories.
40+
41+
For GitHub specifically, we recommend:
42+
43+
```ini
44+
[url "ssh://git@github.com/"]
45+
insteadOf = https://github.com/
46+
47+
[credential "https://github.com"]
48+
helper =
49+
helper = !/usr/local/bin/gh auth git-credential
50+
```
51+
3152
This page shows how to generate functions in the most popular languages and explains how you can manage their dependencies too.
3253

3354
### Classic vs. of-watchdog templates
@@ -77,7 +98,22 @@ Languages available as templates:
7798
- python3-http
7899
```
79100

80-
You can add your own store just by specifying the `--url` flag for both commands to pull and list your custom templates store.
101+
You can create your own template store by following the convention found in the official templates store repository, then provide the `--url` flag when pulling or listing templates. If you're using GitHub, you'll need to reference the *raw* file rather than the view in a webbrowser.
102+
103+
```json
104+
[
105+
{
106+
"template": "golang-middleware",
107+
"platform": "x86_64",
108+
"language": "Go",
109+
"source": "openfaas",
110+
"description": "HTTP middleware interface in Go",
111+
"repo": "https://github.com/openfaas/golang-http-template"
112+
}
113+
]
114+
```
115+
116+
For the official templates, this would be: `https://raw.githubusercontent.com/openfaas/store/refs/heads/master/templates.json`
81117

82118
The classic templates are held in the [openfaas/templates](https://github.com/openfaas/templates) repository.
83119

0 commit comments

Comments
 (0)