Files
linuxkit/pkg/metadata/provider_file.go
Simon Ferquel 3f56669576 Metadata: add support for loading from a file
This adds a new configuration provider that just reads a file.
This is needed for Docker Desktop, where we will run a LinuxKit distro in an isolated namespace within WSL 2.
In this scenario, the config will be accessible trough the WSL2 built-in 9p mount of the Windows filesystem.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-12-20 11:21:20 +01:00

22 lines
308 B
Go

package main
import (
"io/ioutil"
"os"
)
type fileProvider string
func (p fileProvider) String() string {
return string(p)
}
func (p fileProvider) Probe() bool {
_, err := os.Stat(string(p))
return err == nil
}
func (p fileProvider) Extract() ([]byte, error) {
return ioutil.ReadFile(string(p))
}