func HostnameProvider(ctx context.Context, options map[string]interface{}) (string, error) {
	if options == nil {
		return "", fmt.Errorf("'file' hostname provider requires a 'filename' field in options")
	}

	filenameVal, ok := options["filename"]
	if !ok {
		return "", fmt.Errorf("'file' hostname provider requires a 'filename' field in options")
	}

	filename := fmt.Sprintf("%s", filenameVal)
	fileContent, err := ioutil.ReadFile(filename)
	if err != nil {
		return "", fmt.Errorf("Could not read hostname from %s: %v", filename, err)
	}

	hostname := strings.TrimSpace(string(fileContent))

	err = validate.ValidHostname(hostname)
	if err != nil {
		return "", err
	}

	return hostname, nil
}
// HostnameProvider parses a file from the 'filename' option and returns the content
// as the hostname
HostnameProvider parses a file from the 'filename' option and returns the content
as the hostname
// HostnameProvider parses a file from the ' filename ' option and returns the content // as the hostname
func HostnameProvider(ctx context.Context, options map[string]interface{}) (string, error) {
	if options == nil {
		return "", fmt.Errorf("'file' hostname provider requires a 'filename' field in options")
	}
	filenameVal, ok := options["filename"]
	if !ok {
		return "", fmt.Errorf("'file' hostname provider requires a 'filename' field in options")
	}
	filename := fmt.Sprintf("%s", filenameVal)
	fileContent, err := ioutil.ReadFile(filename)
	if err != nil {
		return "", fmt.Errorf("Could not read hostname from %s: %v", filename, err)
	}
	hostname := strings.TrimSpace(string(fileContent))
	err = validate.ValidHostname(hostname)
	if err != nil {
		return "", err
	}
	return hostname, nil
}
func HostnameProvider ( ctx context . Context , options map [ string ] interface { } ) ( string , error ) { if options == nil { return " " , fmt . Errorf ( " " ) } filenameVal , ok := options [ " " ] if ! ok { return " " , fmt . Errorf ( " " ) } filename := fmt . Sprintf ( " " , filenameVal ) fileContent , err := ioutil . ReadFile ( filename ) if err != nil { return " " , fmt . Errorf ( " " , filename , err ) } hostname := strings . TrimSpace ( string ( fileContent ) ) err = validate . ValidHostname ( hostname ) if err != nil { return " " , err } return hostname , nil }
HostnameProvider parses a file from the 'filename' option and returns the content
as the hostname
HostnameProvider parses a file from the ' filename ' option and returns the content as the hostname