mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	create: load default buildkit config if none specified
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		| @@ -2,6 +2,7 @@ package confutil | ||||
|  | ||||
| import ( | ||||
| 	"os" | ||||
| 	"path" | ||||
| 	"path/filepath" | ||||
|  | ||||
| 	"github.com/docker/cli/cli/command" | ||||
| @@ -24,6 +25,15 @@ func ConfigDir(dockerCli command.Cli) string { | ||||
| 	return buildxConfig | ||||
| } | ||||
|  | ||||
| // DefaultConfigFile returns the default BuildKit configuration file path | ||||
| func DefaultConfigFile(dockerCli command.Cli) (string, bool) { | ||||
| 	f := path.Join(ConfigDir(dockerCli), "buildkitd.default.toml") | ||||
| 	if _, err := os.Stat(f); err == nil { | ||||
| 		return f, true | ||||
| 	} | ||||
| 	return "", false | ||||
| } | ||||
|  | ||||
| // loadConfigTree loads BuildKit config toml tree | ||||
| func loadConfigTree(fp string) (*toml.Tree, error) { | ||||
| 	f, err := os.Open(fp) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CrazyMax
					CrazyMax