router

package
v0.0.0-...-acb9b4a Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL_DIR  = "/tmp/data"
	GIT_ORIGIN = "https://github.com/qjw/test.git"
	SWAGGER_UI = "/tmp/swagger_ui"
	FRONTEND   = "/tmp/frontend"
	PORT       = 8888

	REDIS_URL = "redis://localhost:6379/1"

	CORP_ID           = ""
	CORP_AGENT_SECRET = ""
	CORP_AGENT_ID     = ""

	GITLAB_TOKEN = ""
	GITHUB_TOKEN = ""
)
View Source
const (
	STATE = "state"
)

Variables

This section is empty.

Functions

func CheckIfError

func CheckIfError(err error)

func GetEnv

func GetEnv(key, fallback string) string

func GetEnvInt

func GetEnvInt(key string, fallback int) int

func Init

func Init(repository *git.Repository, r kelly.Router, config *Config)

func RemoveContents

func RemoveContents(dir string) error

Types

type Commit

type Commit struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Log   string `json:"log"`
	Hash  string `json:"hash"`
	Time  string `json:"time"`
}

type Config

type Config struct {
	LocalDir string `json:"localDir"`
	// 如果不存在,则不从远程Clone
	GitOrigin string `json:"gitOrigin"`
	SwaggetUi string `json:"swaggerUI"`
	Frontend  string `json:"frontend"`
	Port      int    `json:"port"`

	// Redis
	RedisUrl string `json:"redisUrl""`

	// ----------------------企业号
	// 企业号corpid
	CorpID string `json:"corpID"`
	// 企业号App密钥
	CorpAgentSecret string `json:"corpAgentSecret"`
	// 因为同一个企业号会有多个Secret,这里用于区分
	CorpAgentId string `json:"corpAgentID"`

	// gitlab/github hook
	GitlabToken string `json:"gitlabToken"`
	GithubToken string `json:"githubToken"`
}

func InitConfig

func InitConfig() *Config

type Current

type Current struct {
	Global
}

type GithubHookNotify

type GithubHookNotify struct {
	Ref    string `json:"ref"`
	Before string `json:"before"`
	After  string `json:"after"`
	Pusher struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"pusher,omitempty"`
	Sender struct {
		Login string `json:"login"`
	} `json:"sender,omitempty"`
	Repository struct {
		Name     string `json:"name"`
		FullName string `json:"full_name"`
		HtmlUrl  string `json:"html_url"`
	} `json:"repository,omitempty"`
	Commits []struct {
		ID        string `json:"id"`
		Message   string `json:"message"`
		Timestamp string `json:"timestamp"`
		Url       string `json:"url"`
	} `json:"commits,omitempty"`
}

type GitlabHookNotify

type GitlabHookNotify struct {
	ObjectKind string `json:"object_kind"`

	// push event
	EventName         string `json:"event_name,omitempty"`
	Ref               string `json:"ref,omitempty"`
	CheckoutSha       string `json:"checkout_sha,omitempty"`
	TotalCommitsCount int    `json:"total_commits_count,omitempty"`
	Name              string `json:"user_name,omitempty"`
	Email             string `json:"user_email,omitempty"`
	AvatarUrl         string `json:"user_avatar,omitempty"`

	User User `json:"user"`
}

type Global

type Global struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Company     string `json:"company"`
}

type LoginUrl

type LoginUrl struct {
	Url string `json:"url" binding:"required,url"`
}

type Spec

type Spec struct {
	Groups []struct {
		Name        string `json:"name"`
		Description string `json:"description"`
		Projects    []struct {
			Name        string `json:"name"`
			Description string `json:"description"`
			Spec        string `json:"spec"`
		} `json:"projects"`
	} `json:"groups"`
	Global
}

type User

type User struct {
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
}

Jump to

Keyboard shortcuts

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