summaryrefslogtreecommitdiff
path: root/internal/datafs/default.go
blob: 52cf55009b1b3b1179f1226ceb94128fd81726f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package datafs

import (
	"sync"

	"github.com/hairyhenderson/go-fsimpl"
	"github.com/hairyhenderson/go-fsimpl/autofs"
)

// DefaultProvider is the default filesystem provider used by gomplate
var DefaultProvider = sync.OnceValue(
	func() fsimpl.FSProvider {
		fsp := fsimpl.NewMux()

		// start with all go-fsimpl filesystems
		fsp.Add(autofs.FS)

		// override go-fsimpl's filefs with wdfs to handle working directories
		fsp.Add(wdFSProvider)

		// gomplate-only filesystems
		fsp.Add(EnvFS)
		fsp.Add(StdinFS)
		fsp.Add(mergeFSProvider)

		return fsp
	})()