"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

Save draft mail in Zimbra web client using ChromeDP

2020-07-03

As an engineer, I want to automate everything as much as possible. This CLI tool is created to save a draft mail in Zimbra web client.

Read config file:

 1func initConfig() {
 2	if cfgFile != "" {
 3		// Use config file from the flag.
 4		viper.SetConfigFile(cfgFile)
 5	} else {
 6		// Find home directory.
 7		home, err := homedir.Dir()
 8		if err != nil {
 9			fmt.Println(err)
10			os.Exit(1)
11		}
12
13		// Search config in home directory with name ".zwc" (without extension).
14		viper.AddConfigPath(home)
15		viper.SetConfigName(".zwc")
16	}
17
18	viper.AutomaticEnv() // read in environment variables that match
19
20	// If a config file is found, read it in.
21	if err := viper.ReadInConfig(); err != nil {
22		log.Fatal(err)
23	}
24
25	fmt.Println("Using config file:", viper.ConfigFileUsed())
26}

Read More...