Пример #1
0
func ParseConf() {
	prop := goprop.NewProp()
	path, err := GetExecPath()
	if err != nil {
		os.Exit(1)
	}
	confFilename := fmt.Sprintf("%s/conf/conf.properties", path)
	prop.Read(confFilename)
	addr := prop.Get("addr")
	docs := prop.Get("docs")
	rename, err := strconv.ParseBool(prop.Get("rename"))
	if err != nil {
		rename = false
	}
	watermark := prop.Get("watermark")
	Sett = &Setting{Addr: addr, Docs: docs, Rename: rename, Watermark: watermark}
	RootPhysicalPath = filepath.Join(docs, ROOT_DIR)
}
Пример #2
0
func InitArgs(propPath string) {
	// if os.Getenv("GOPATH") == "" {
	// 	return
	// }
	Path = PathProps{}
	prop := goprop.NewProp()
	prop.Read(propPath)
	// prop.Read(os.Getenv("GOPATH") + PROP_FILE)
	Path.MarathonAppsUrl = prop.Get("marathon.apps.url")
	Path.MarathonGroupsUrl = prop.Get("marathon.groups.url")
	Path.DockerRegistryUrl = prop.Get("docker.registry.url")
	Path.DockerRegistrySearchUrl = Path.DockerRegistryUrl + prop.Get("docker.registry.search.url")
	Path.MongoUrl = prop.Get("mongo.url")
	Path.CloudServerUrl = prop.Get("cloud.server.url")
	Path.CloudServerIpholderUrl = Path.CloudServerUrl + prop.Get("cloud.server.ipholder.url")
	Path.RedisUrl = prop.Get("redis.url")

	Param.MongoDB = prop.Get("mongo.db")

}
Пример #3
0
func init() {
	goCore = GoCore{"", ""}
	prop := goprop.NewProp()
	prop.Read(os.Getenv("GOPATH") + PROP_FILE)
	goCore.MarathonAppsUrl = prop.Get("marathon.apps.url")
	goCore.MarathonGroupsUrl = prop.Get("marathon.groups.url")

	htmlPath := os.Getenv("GOPATH") + STATIC_DIR + string(os.PathSeparator) + TMPL_NAME + string(os.PathSeparator)
	fileInfoArray, err := ioutil.ReadDir(htmlPath)
	CheckError(err)

	var fileName, filePath string
	for _, fileInfo := range fileInfoArray {
		fileName = fileInfo.Name()
		if ext := path.Ext(fileName); ext != ("." + TMPL_NAME) {
			continue
		}
		filePath = htmlPath + fileName
		log.Println("loading template: " + filePath)
		t := template.Must(template.New(fileName).Delims("[[", "]]").ParseFiles(filePath))
		templates[fileName] = t
	}
}