config

package
v0.0.0-...-472fa29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

配置文件

数据库基础功能封装

日志相关功能

Index

Constants

View Source
const (
	REQUEST_ERROR = 401
	UN_AUTH       = 403
	OK            = 200
	SERVER_ERROR  = 500
)
View Source
const ACCESS_TOKEN_KEY = "x-access-token"
View Source
const CONFIG_FILE = "./app.conf"
View Source
const SHARED_SECRET = "!@#$%^&*()_+1234567890-="

Variables

This section is empty.

Functions

func InitLogger

func InitLogger()

初始化日志配置

Types

type CApp

type CApp struct {
	Name    string
	Host    string
	Port    int
	Version string
}

type CJWT

type CJWT struct {
	SharedSecret   string
	AccessTokenKey string
}

func (*CJWT) NewToken

func (this *CJWT) NewToken(subject interface{}) (string, error)

func (*CJWT) ParseToken

func (this *CJWT) ParseToken(tokenString string) (*jwt.Token, error)

type CMongo

type CMongo struct {
	Url  string
	Name string
	// contains filtered or unexported fields
}

func (*CMongo) GetSession

func (this *CMongo) GetSession() *mgo.Session

type Config

type Config struct {
	App   *CApp
	Mongo *CMongo
	JWT   *CJWT
}

func InitConfig

func InitConfig() (*Config, error)

初始化配置文件

type DB

type DB struct {
	Url      string //连接地址
	Name     string //数据库名称
	Username string //连接用户名
	Password string //连接密码
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL