// applyServers will apply the servers from the config-file
// to the service.
applyServers will apply the servers from the config-file
to the service.
// applyServers will apply the servers from the config - file // to the service .
func applyServers(ctx context.Context, path string) error {
	cfg, err := configs.Get(path)
	if err != nil {
		return fmt.Errorf("Couldn't parse yml-file %s : %v", path, err)
	}
	fmt.Fprintf(os.Stdout, "INFO : Testing connection to servers\nPlease wait...\n")
	var count int
	for _, srv := range cfg.API.Servers {
		err = configs.ValidateServerConfig(srv.Server)
		if err != nil {
			return err
		}
		server := configs.PostprocessServerConfig(srv.Server)
		_, err := srvService.Apply(ctx, server)
		if err != nil {
			return err
		}
		fmt.Fprintf(os.Stdout, "server: %s has been applied\n", server.Hostname)
		count++
	}
	fmt.Fprintf(os.Stdout, "applied %d servers to backend", count)
	return nil
}
func applyServers ( ctx context . Context , path string ) error { cfg , err := configs . Get ( path ) if err != nil { return fmt . Errorf ( " " , path , err ) } fmt . Fprintf ( os . Stdout , " \n \n " ) var count int for _ , srv := range cfg . API . Servers { err = configs . ValidateServerConfig ( srv . Server ) if err != nil { return err } server := configs . PostprocessServerConfig ( srv . Server ) _ , err := srvService . Apply ( ctx , server ) if err != nil { return err } fmt . Fprintf ( os . Stdout , " \n " , server . Hostname ) count ++ } fmt . Fprintf ( os . Stdout , " " , count ) return nil }
applyServers will apply the servers from the config-file
to the service.
applyServers will apply the servers from the config - file to the service .
// Get the config with the servers' info. // Output that the service is testing connections to the applied servers. // Validate and post-process server config. // Apply server.