mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-10-30 01:03:09 +00:00
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>
22 lines
308 B
Go
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))
|
|
}
|