Esempio n. 1
0
func getConfig() (conf config.Configer, err error) {
	home := os.Getenv("HOME")
	if home != "" {
		homePath := filepath.Join(home, ".dockyard", "containerops.conf")
		conf, err = config.NewConfig("ini", homePath)
	}

	if err != nil {
		conf, err = config.NewConfig("ini", "conf/containerops.conf")
	}

	return
}
Esempio n. 2
0
func amazons3getconfig(conffile string) (err error) {
	conf, err := config.NewConfig("ini", conffile)
	if err != nil {
		return err
	}

	g_amazons3Endpoint = conf.String("amazons3cloud::endpoint")
	if g_amazons3Endpoint == "" {
		return errors.New("read config file's endpoint failed!")
	}

	g_amazons3Bucket = conf.String("amazons3cloud::bucket")
	if g_amazons3Bucket == "" {
		return errors.New("read config file's bucket failed!")
	}

	g_amazons3AccessKeyID = conf.String("amazons3cloud::accessKeyID")
	if g_amazons3AccessKeyID == "" {
		return errors.New("read config file's accessKeyID failed!")
	}

	g_amazons3AccessKeySecret = conf.String("amazons3cloud::accessKeysecret")
	if g_amazons3AccessKeySecret == "" {
		return errors.New("read config file's accessKeysecret failed!")
	}
	return nil
}
Esempio n. 3
0
func (this *Configuration) Get() config.ConfigContainer {
	data, error := config.NewConfig("yaml", "./conf/app.yml")
	if error != nil {
		log.Fatal(error)
	}
	return data
}
Esempio n. 4
0
func qiniugetconfig(conffile string) (err error) {
	var conf config.ConfigContainer
	conf, err = config.NewConfig("ini", conffile)
	if err != nil {
		return err
	}

	g_qiniuEndpoint = conf.String("qiniucloud::endpoint")
	if g_qiniuEndpoint == "" {
		return errors.New("read config file's endpoint failed!")
	}

	g_qiniuBucket = conf.String("qiniucloud::bucket")
	if g_qiniuBucket == "" {
		return errors.New("read config file's bucket failed!")
	}

	g_qiniuAccessKeyID = conf.String("qiniucloud::accessKeyID")
	if g_qiniuAccessKeyID == "" {
		return errors.New("read config file's accessKeyID failed!")
	}

	g_qiniuAccessKeySecret = conf.String("qiniucloud::accessKeysecret")
	if g_qiniuAccessKeySecret == "" {
		return errors.New("read config file's accessKeysecret failed!")
	}
	return nil
}
Esempio n. 5
0
func init() {

	cmd, err := notify.NewCmd("telegram-cli", "-C")

	if err != nil {
		log.Fatal("NewCmd error", err)
	}

	botConf = Conf{
		Limit: 10,
		Url:   "localhost",
		Rpms:  500,
		Cmd:   cmd,
	}

	//Init Data Mapper
	c, err := beeconf.NewConfig("ini", "../../conf/app.conf")

	if err != nil {
		log.Fatal(err)
	}

	TestConfig, err := conf.Initialize("test", c)
	if err != nil {
		log.Fatal(err)
	}

	if err := M.DbOpen(TestConfig.Db); err != nil {
		log.Fatal(err)
	}

	M.PrepareTables(&M.Cand{})
	Tfn, _ := i18n.Tfunc("en-us", "en-us", "en-us")
	M.T = Tfn
}
Esempio n. 6
0
func main() {
	tracelog.StartFile(tracelog.LevelTrace, "logs", 1)
	tracelog.Started("main", "Initializing Postgres")
	var confName string = os.Getenv("BOOKS_CONF")
	if len(confName) == 0 {
		confName = "default"
	}
	s := []string{"conf/db/", confName, ".json"}
	jsonconf, err := config.NewConfig("json", strings.Join(s, ""))
	if err != nil {
		tracelog.Errorf(err, "main", "config.NewConfig", "Failed to find config", strings.Join(s, ""))
	}
	var User string = jsonconf.String("User")
	var Pass string = jsonconf.String("Pass")
	var DBName string = jsonconf.String("DBName")
	var buffer bytes.Buffer
	buffer.WriteString("user="******" password="******" dbname=")
	buffer.WriteString(DBName)
	s2 := []string{"user="******" password="******" dbname=", DBName, " sslmode=disable"}
	orm.RegisterDriver("postgres", orm.DR_Postgres)
	orm.RegisterDataBase("default", "postgres", strings.Join(s2, ""))
	beego.SetStaticPath("/images", "static/images")
	beego.SetStaticPath("/css", "static/css")
	beego.SetStaticPath("/js", "static/js")
	beego.SetStaticPath("/fonts", "static/fonts")
	beego.SetStaticPath("/partials", "static/partials")
	beego.EnableAdmin = true
	orm.RunCommand()
	beego.Run()
}
Esempio n. 7
0
func init() {
	duangcfg, err := config.NewConfig("ini", "conf/duang.conf")
	if err != nil {
		fmt.Println(err)
		return
	}
	orm.RegisterDriver("mysql", orm.DR_MySQL)
	orm.RegisterDataBase("default", "mysql", fmt.Sprintf("%s:%s@%s/%s?charset=utf8", duangcfg.String("db_user"), duangcfg.String("db_pass"), duangcfg.String("db_addr"), duangcfg.String("db_name")))

	orm.RegisterModel(
		new(Unit),
		new(UnitParameter),
		new(Dockerd),
		new(Ip),
		new(Container),
		//new(Frontend),
		//new(Backend),
	)

	force, err := duangcfg.Bool("db_dropifexist")
	if err != nil {
		force = false
	}

	verbose := true
	err = orm.RunSyncdb("default", force, verbose)
	if err != nil {
		beego.Error(err)
	}

}
Esempio n. 8
0
func Test_upyunsave(t *testing.T) {
	var err error
	var conf config.ConfigContainer
	var url string

	conf, err = config.NewConfig("ini", "../../../conf/containerops.conf")
	if err != nil {
		t.Error(err)
	}

	d := new(UpyunDrv)
	err = d.ReadConfig(conf)
	if err != nil {
		t.Error(err)
	}

	file := "upyun_test.go"
	url, err = upyunsave(file)
	if err != nil {
		t.Error(err)
	}
	_, err = http.Get(url)
	if err != nil {
		t.Error(err)
	}
}
Esempio n. 9
0
func newAppConfig(appConfigProvider, appConfigPath string) (*beegoAppConfig, error) {
	ac, err := config.NewConfig(appConfigProvider, appConfigPath)
	if err != nil {
		return nil, err
	}
	return &beegoAppConfig{ac}, nil
}
Esempio n. 10
0
func initORM() {
	if ormInitiated {
		return
	}
	appConf, err := config.NewConfig("ini", "conf/app.conf")
	if err != nil {
		panic(err)
	}
	dbAddr := appConf.String("admin::dbAddr")
	dbUser := appConf.String("admin::dbUser")
	dbPass := appConf.String("admin::dbPass")
	controllers.ALI_YUN_AK_ID = appConf.String("admin::akId")
	controllers.ALI_YUN_AK_KEY = appConf.String("admin::akKey")
	controllers.QQ_OAUTH_CONSUMER_KEY = appConf.String("admin::qqOAuthConsumerKey")
	clientId := appConf.String("admin::clientId")
	clientSecret := appConf.String("admin::clientSecret")
	controllers.BASIC_AUTH_AUTHORIZATION = utils.Base64(clientId + ":" + clientSecret)

	controllers.VISITOR_TOKEN = appConf.String("admin::visitorToken")

	orm.RegisterDriver("mymysql", orm.DRMySQL)
	conn := fmt.Sprintf("%s:%s@tcp(%s)/beego_unit_test?charset=utf8mb4", dbUser, dbPass, dbAddr)
	orm.RegisterDataBase("default", "mysql", conn)
	ormInitiated = true
}
Esempio n. 11
0
func NewConfig(file string) (Configure, error) {
	appConfigPath, isCurrentDir, err := findAppConfPath(file)
	if err != nil {
		return nil, err
	}
	configer, err := config.NewConfig("ini", appConfigPath)
	if err != nil {
		return nil, err
	}

	var runMode string
	if isCurrentDir == false {
		runMode = "test"
	} else if envRunMode := os.Getenv("BEEGO_RUNMODE"); envRunMode != "" {
		runMode = envRunMode
	} else if configRunMode := configer.String("RunMode"); configRunMode != "" {
		runMode = configRunMode
	} else {
		runMode = "dev"
	}

	return &configureImplement{
		runMode:  runMode,
		configer: configer,
	}, nil
}
Esempio n. 12
0
func (c *ZhouBianWifiWXController) Get() {
	op := c.Input().Get("op")
	switch op {
	case "location":
		latitude := c.Input().Get("latitude")
		longitude := c.Input().Get("longitude")
		c.Data["latitude"] = latitude
		c.Data["longitude"] = longitude
		beego.Debug("latitude:", latitude)
		beego.Debug("longitude:", longitude)
		getWifi(longitude, latitude, c)
		c.TplName = "zhoubianwifi.html"
		return
	}
	appId := ""
	iniconf, err := config.NewConfig("json", "conf/myconfig.json")
	if err != nil {
		beego.Debug(err)
	} else {
		appId = iniconf.String("qax580::appid")
	}
	timestamp := time.Now().Unix()
	noncestr := getNonceStr(16, KC_RAND_KIND_ALL)
	c.Data["AppId"] = appId
	c.Data["TimesTamp"] = timestamp
	c.Data["NonceStr"] = noncestr
	getWifiWxJsToken(noncestr, timestamp, c)
	c.TplName = "zhoubianwifiwx.html"
	// getWifi("116.366324", "39.905859", c)
	// c.TplName = "zhoubianwifi.html"
}
Esempio n. 13
0
func initDb() {
	iniconf, err := config.NewConfig("ini", "conf/app.conf")
	if err != nil {
		beego.Error(err)
	}
	driverName := iniconf.String("orm::driver_name")
	dataSource := iniconf.String("orm::data_source")
	maxIdle, _ := iniconf.Int("orm::max_idle_conn")
	maxOpen, _ := iniconf.Int("orm::max_open_conn")

	// set default database
	err = orm.RegisterDataBase("default", driverName, dataSource, maxIdle, maxOpen)
	if err != nil {
		beego.Error(err)
	}
	//	orm.Debug = true

	//orm.RunCommand()							//执行命令行的

	err = orm.RunSyncdb("default", false, false) //建表的
	////数据库别名,不强制建数据库,打印建表过程

	if err != nil {
		beego.Error(err)
	}
}
Esempio n. 14
0
func readConfig() {
	jsonconf, err := config.NewConfig("json", "conf/config.json")
	if err != nil {
		panic(err)
	}

	BlogInfo = make(map[string]string)
	BlogInfo["title"] = jsonconf.String("blog::title")
	BlogInfo["subtitle"] = jsonconf.String("blog::subtitle")
	fmt.Println(BlogInfo)

	admin = new(User)
	admin.Email = jsonconf.String("admin::email")
	admin.Username = jsonconf.String("admin::username")
	admin.Password = jsonconf.String("admin::password")
	_, err = c_users.RemoveAll(bson.M{})
	if err != nil {
		panic(err)
	}
	AddUser(admin)

	h := md5.New()
	h.Write([]byte(admin.Email))
	BlogInfo["avatarhash"] = fmt.Sprintf("%x", h.Sum(nil))
}
Esempio n. 15
0
func ConnectDB(env string) {
	DBconf, err := config.NewConfig("ini", "config/database.conf")

	if err != nil {
		panic(err)
	}

	config, err := DBconf.GetSection(env)

	if err != nil {
		panic(err)
	}

	DB, err = gorm.Open("postgres", "host="+config["host"]+" user="******"user"]+" dbname="+config["dbname"]+" sslmode=disable")

	if err != nil {
		log.Fatalln(err)
		return
	}

	switch env {
	case "dev":
		// DB.LogMode(true)
	case "test":
		loadFixtures()
	}
}
Esempio n. 16
0
func TestGetDockerConf(t *testing.T) {
	path := "../testsuite.conf"
	conf, err := config.NewConfig("ini", path)
	if err != nil {
		t.Errorf("Read %s error: %v", path, err.Error())
	}

	if domains := conf.String("test::domains"); domains != "" {
		Domains = domains
	} else {
		t.Errorf("Read %s error: nil", domains)
	}

	if username := conf.String("test::username"); username != "" {
		UserName = username
	} else {
		t.Errorf("Read %s error: nil", username)
	}

	if client := conf.String("test::client"); client != "" {
		DockerBinary = client
	} else {
		t.Errorf("Read %s error: nil", client)
	}
}
Esempio n. 17
0
///////////////////////////////////////////////
// Create user directories, for code files and resources
func (c *SignupController) createUserDirectory(user models.User, group string) {

	// Create project directories
	models.CreateDirectories(beego.AppConfig.String("userdata::location")+user.Name, true)

	// Create .spielplatz files
	dir := beego.AppConfig.String("userdata::location") + user.Name + "/" + beego.AppConfig.String("userdata::spielplatzdir") + "/"
	identityFile := dir + "identity"
	file, err := os.Create(identityFile)
	if err != nil {
		beego.Error(err)
	}
	file.Close()
	cnf, err := config.NewConfig("ini", identityFile)
	if err != nil {
		beego.Error("Cannot create identity file in " + dir + " (" + err.Error() + ")")
	}
	cnf.Set("auth::Pwhash", user.Pwhash)
	cnf.Set("rights::NoSpecialRights", "true")
	cnf.Set("groups::member", group)
	cnf.SaveConfigFile(identityFile)

	// Clone Admin Spielplatz project
	err = models.CloneProjectDir(user.Name, beego.AppConfig.String("userdata::commonproject"), true)
	if err != nil {
		beego.Error(err)
	}
}
Esempio n. 18
0
func newConfig() config.ConfigContainer {
	cnf, err := config.NewConfig("yaml", "config.yaml")
	if err != nil {
		panic(err)
	}
	return cnf
}
Esempio n. 19
0
func upgetconfig(conffile string) (err error) {
	var conf config.ConfigContainer
	conf, err = config.NewConfig("ini", conffile)
	if err != nil {
		return err
	}

	g_upEndpoint = conf.String("upCloud::endpoint")
	if g_upEndpoint == "" {
		return errors.New("read config file's endpoint failed!")
	}

	g_upBucket = conf.String("upCloud::bucket")
	if g_upBucket == "" {
		return errors.New("read config file's bucket failed!")
	}

	g_upUser = conf.String("upCloud::user")
	if g_upUser == "" {
		return errors.New("read config file's user failed!")
	}

	g_upPasswd = conf.String("upCloud::passwd")
	if g_upPasswd == "" {
		return errors.New("read config file's passwd failed!")

	}
	return nil
}
Esempio n. 20
0
func init() {
	err := errors.New("")

	Appconf, err = config.NewConfig("json", "conf/blog.json")
	if err != nil {
		panic(err)
	}

	// fmt.Println(Appconf.Int("database::port"))
	host := Appconf.String("database::host")
	port, _ := Appconf.Int("database::port")
	// fmt.Println(Appconf.DIY("blog::author"))

	db, err = ssdb.Connect(host, port)
	if err != nil {
		panic(err)
	}

	authorsRaw, err := Appconf.DIY("blog::author")
	if err != nil {
		panic(err)
	}
	authors := authorsRaw.([]interface{})
	for _, a := range authors {
		atemp, ok := a.(map[string]interface{})
		if !ok {
			panic(ok)
		}

		author := &Author{}
		author.Name = atemp["name"].(string)
		author.Password = atemp["password"].(string)
		AddAuthor(author.Name, author.Password)
	}
}
Esempio n. 21
0
func InitEnv(configPath string) {

	if !filetool.IsExist(configPath) {
		log.Warn("configuration file[%s] is nonexistent", configPath)
		UseSystemConfig = true
	}

	if !UseSystemConfig {
		var err error
		Config, err = config.NewConfig("ini", configPath)
		if err != nil {
			log.Fetal("configuration file[%s] cannot parse. ", configPath)
			os.Exit(1)
		}
	}

	if !UseSystemConfig {
		log.SetLevelWithDefault(Config.String("log::level"), "info")
	} else {
		log.SetLevel("info")
	}

	initCfg()

	defaultPidPath := "/var/run/falcon_eye/falcon_eye.pid"
	if !UseSystemConfig {
		if iniPidPath := Config.String("common::pid"); iniPidPath != "" {
			defaultPidPath = iniPidPath
		}
	}
	systool.WritePidFile(defaultPidPath)

	runtime.GOMAXPROCS(runtime.NumCPU())
}
Esempio n. 22
0
func parse(conf string) {
	iniconf, err := config.NewConfig("ini", conf)
	if err != nil {
		log.Panic(err)
	}
	rootdir := iniconf.String(ROOTDIR)
	monitorDir := strings.Split(rootdir, ";")
	// todo multi rootdir
	monitor.Interval, _ = iniconf.Int(INTERVAL)
	monitor.WorkDir = iniconf.String(WORKDIR)
	monitor.RunCmd = iniconf.String(RUNCMD)
	monitor.BuildCmd = iniconf.String(BUILDCMD)
	log.Printf("BuildCmd :%s\n", monitor.BuildCmd)
	log.Printf("RunCmd :%s\n", monitor.RunCmd)

	gopath := os.Getenv("GOPATH")
	for _, dir := range monitorDir {
		dir = strings.Replace(dir, "$GoPath", gopath, -1)
		err = monitor.AddRootDir(dir)
		if err != nil {
			fmt.Printf("%s", err)
		}
	}

}
Esempio n. 23
0
func (this *assetPipelineConfig) Parse(filename string) {
	config, err := config.NewConfig("ini", filename)
	if err != nil {
		fmt.Println(err)
		return
	}
	Config.Runmode = beego.AppConfig.DefaultString("runmode", "dev")
	locations := config.DefaultString("assets_dirs", "")
	Config.AssetsLocations = strings.Split(locations, ",")

	public_dirs := config.DefaultString("public_dirs", "")
	Config.PublicDirs = strings.Split(public_dirs, ",")
	Config.TempDir = config.DefaultString("temp_dir", "static/assets")

	runmode_params, err := config.GetSection(Config.Runmode)
	if err != nil {
		Logger.Warn("Can't get section \"%v\" from config asset-pipeline.conf. Using default params", Config.Runmode)
	}
	getBoolFromMap(&runmode_params, "minify_css", &Config.MinifyCSS, false)
	getBoolFromMap(&runmode_params, "minify_js", &Config.MinifyJS, false)
	getBoolFromMap(&runmode_params, "combine_css", &Config.CombineCSS, false)
	getBoolFromMap(&runmode_params, "combine_js", &Config.CombineJS, false)
	getBoolFromMap(&runmode_params, "production_mode", &Config.ProductionMode, false)

}
Esempio n. 24
0
func (app *WeChatApp) SetConfig(adapter, file string) error {
	var err error
	app.Config, err = config.NewConfig(adapter, file)
	if err != nil {
		return err
	} else {
		app.AppHost = app.Config.String("AppHost")

		if v, err := app.Config.Int("AppPort"); err == nil {
			app.AppPort = v
		}

		if v := app.Config.String("AppURI"); v != "" {
			app.AppURI = v
		}
		if v := app.Config.String("AppToken"); v != "" {
			app.AppToken = v
		}
		if v := app.Config.String("AppId"); v != "" {
			app.AppId = v
		}
		if v := app.Config.String("AppSecret"); v != "" {
			app.AppSecret = v
		}
	}
	return nil
}
Esempio n. 25
0
func (this *oss) LoadChunkMasterConfig() error {
	var err error
	confpath := "oss/chunkmaster.conf"
	conf, err := config.NewConfig("ini", confpath)
	if err != nil {
		return fmt.Errorf("Read OSS config file %s error: %v", confpath, err.Error())
	}
	// load chunkmaster configs
	if servermode := conf.String("servermode"); servermode != "" {
		this.ServerMode = servermode
	} else {
		this.ServerMode = "allinone"
	}
	if masterhost := conf.String("masterhost"); masterhost != "" {
		this.cm.serverHost = masterhost
		apiserver.MasterUrl = masterhost
	} else {
		err = fmt.Errorf("masterhost value is null")
	}
	this.cm.serverPort, err = conf.Int("masterport")
	apiserver.MasterPort = strconv.Itoa(this.cm.serverPort)

	if metahost := conf.String("metahost"); metahost != "" {
		this.cm.metaHost = metahost
		apiserver.MetadbIp = metahost
	} else {
		err = fmt.Errorf("metaHost  value is null")
	}
	if metaport := conf.String("metaport"); metaport != "" {
		this.cm.metaPort = metaport
		apiserver.MetadbPort, err = strconv.Atoi(metaport)
	} else {
		err = fmt.Errorf("metaport  value is null")
	}

	if dbuser := conf.String("dbuser"); dbuser != "" {
		this.cm.user = dbuser
		apiserver.MetadbUser = dbuser
	} else {
		err = fmt.Errorf("dbuser value is null")
	}
	if dbpasswd := conf.String("dbpasswd"); dbpasswd != "" {
		this.cm.passwd = dbpasswd
		apiserver.MetadbPassword = dbpasswd
	} else {
		err = fmt.Errorf("dbpasswd value is null")
	}
	if db := conf.String("db"); db != "" {
		this.cm.db = db
	} else {
		err = fmt.Errorf("db value is null")
	}
	this.cm.limitCSNum, err = conf.Int("limitcsnum")
	apiserver.LimitNum = this.cm.limitCSNum
	this.cm.connPoolCapacity, err = conf.Int("connpoolcapacity")
	apiserver.ConnPoolCapacity = this.cm.connPoolCapacity

	return nil
}
Esempio n. 26
0
func InitNav() {
	nav, err := config.NewConfig("json", "conf/nav.json")
	if err != nil {
		beego.Error(err)
	}
	diy, err := nav.DIY("nav")
	beego.Info(diy)
}
Esempio n. 27
0
func main() {
	iniconf, err := config.NewConfig("ini", "ini.conf")
	if err != nil {
		fmt.Println("err=", err.Error())
	}
	username := iniconf.String("user::username")
	fmt.Println("获取init文件中的值:", username)
}
Esempio n. 28
0
func (this *MCscheduler) Init() error {
	duangcfg, err := config.NewConfig("ini", "conf/duang.conf")
	if err != nil {
		fmt.Println(err)
		return err
	}

	v := duangcfg.String("snmp_version")
	if v == "1" || v == "v1" {
		this.Version = wapsnmp.SNMPv1
	} else if v == "2c" || v == "v2c" {
		this.Version = wapsnmp.SNMPv2c
	} else {
		err = errors.New(fmt.Sprintf("duang.cfg snmp_version should be 1 or 2c, but got: %s", v))
		beego.Error(err)
		return err
	}

	this.Community = duangcfg.String("snmp_community")
	if len(this.Community) < 1 {
		err = errors.New("duang.conf snmp_community cannot be null")
		beego.Error(err)
		return err
	}

	timeout, err := duangcfg.Int("snmp_timeout")
	if err != nil {
		beego.Error(err)
		return err
	}
	this.Timeout = timeout

	retry, err := duangcfg.Int("snmp_retry")
	if err != nil {
		beego.Error(err)
		return err
	}
	this.Retry = retry

	o := orm.NewOrm()
	o.Using("default")

	this.DockerdForSortList = make([]*DockerdForSort, 0)
	dockerdList := make([]*core.Dockerd, 0)
	_, err = o.QueryTable("dockerd").All(&dockerdList)
	if err != nil {
		beego.Error(err)
		return err
	}

	for _, dockerd := range dockerdList {
		//this.Score[dockerd] = 0
		this.DockerdForSortList = append(this.DockerdForSortList, &DockerdForSort{Dockerd: dockerd, Score: 0})
	}

	this.UpdateScore()
	return nil
}
Esempio n. 29
0
func (c *DqsjController) GuangGao() {
	if c.Ctx.Input.IsGet() {
		beego.Debug("GuangGao Get")
	}
	if c.Ctx.Input.IsPost() {
		beego.Debug("GuangGao Post")
	}
	//微信分享
	token := getDqsjToken()
	if len(token) > 0 {
		beego.Debug("http_dqsj_token :", token)
	}
	appId := ""
	isdebug := "flase"
	iniconf, err := config.NewConfig("json", "conf/myconfig.json")
	if err != nil {
		beego.Debug(err)
	} else {
		appId = iniconf.String("qax580::appid")
		isdebug = iniconf.String("qax580::isdebug")
	}
	url := "http://www.baoguangguang.cn/dqsj/guanggao"
	if isdebug == "true" {
		url = "http://localhost:8080/dqsj/guanggao"
	}
	timestamp := time.Now().Unix()
	noncestr := getNonceStr(16, KC_RAND_KIND_ALL)
	ticket := getDqsjTicket(token)
	c.Data["AppId"] = appId
	c.Data["TimesTamp"] = timestamp
	c.Data["NonceStr"] = noncestr
	c.Data["Ticket"] = signatureWxJs(ticket, noncestr, timestamp, url)
	wxShareCon := models.WxShareCon{}
	wxShareCon.Title = "大签世界火盆烤肉欢迎您的到来!"
	wxShareCon.Link = url
	wxShareCon.ImgUrl = "http://182.92.167.29:8080/static/img/dqsjicon.jpg"
	c.Data["WxShareCon"] = wxShareCon
	// beego.Debug(wxShareCon)

	op := c.Input().Get("op")
	switch op {
	case "con":
		id := c.Input().Get("id")
		if len(id) == 0 {
			break
		}
		guangao, err := models.GetOneDqsjGuanggao(id)
		if err != nil {
			beego.Error(err)
		}
		c.Data["Guanggao"] = guangao
		beego.Debug("guangao :", guangao)
		c.TplName = "dqsjguanggao.html"
		return
	}

	c.TplName = "dqsjguanggao.html"
}
Esempio n. 30
0
// "ini" file as default
func NewConfigReader(path string) *ConfigReader {
	iniconf, err := config.NewConfig("ini", path)
	if err != nil {
		zwflog.LogError("New config reader failed! Desc:%s", err.Error())
		return nil
	}

	return &ConfigReader{iniconf}
}