2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2026-01-24 02:25:04 +00:00

feat: add --dns and --dns-search flags to customize the vm dns configuration

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2026-01-21 17:23:57 +01:00
parent f799dc4891
commit 0ecdf57a6a
9 changed files with 58 additions and 6 deletions

View File

@@ -111,6 +111,8 @@ var (
d2vm.WithPlatform(platform),
d2vm.WithPull(false),
d2vm.WithHostname(hostname),
d2vm.WithDNS(dns),
d2vm.WithDNSSearch(dnsSearch),
); err != nil {
return err
}

View File

@@ -92,6 +92,8 @@ var (
d2vm.WithPlatform(platform),
d2vm.WithPull(pull),
d2vm.WithHostname(hostname),
d2vm.WithDNS(dns),
d2vm.WithDNSSearch(dnsSearch),
); err != nil {
return err
}

View File

@@ -45,7 +45,9 @@ var (
keepCache bool
platform string
hostname string
hostname string
dns []string
dnsSearch []string
)
func validateFlags() error {
@@ -119,5 +121,7 @@ func buildFlags() *pflag.FlagSet {
flags.StringVar(&platform, "platform", d2vm.Arch, "Platform to use for the container disk image, linux/arm64 and linux/arm64 are supported")
flags.BoolVar(&pull, "pull", false, "Always pull docker image")
flags.StringVar(&hostname, "hostname", "localhost", "Hostname to set in the generated image")
flags.StringSliceVar(&dns, "dns", []string{}, "DNS servers to set in the generated image")
flags.StringSliceVar(&dnsSearch, "dns-search", []string{}, "DNS search domains to set in the generated image")
return flags
}