Documentation
¶
Index ¶
- Constants
- func CommitLink(provider, repo, ref string) string
- func CompareLink(provider, repo, oldCommit, newCommit string) string
- func InitCron()
- func InitMail()
- func InitRouter()
- func InitSession()
- func InitView()
- func LoadConfig(appConfigFile string)
- func RepoLink(provider, repo string) string
- func StringIn(list []string, key string) bool
- func Stringify(anyStruct interface{}) string
- func TreeLink(provider, repo, ref string) string
- func WebhooksList() []string
- func WebsiteLink(provider string) string
- type AppConfig
- type Authentication
- type ByInt
- type CacheWriter
- type CacheWriterIface
- type Frequency
- type GitClient
- type GitRefWithCommit
- type GitRemoteIface
- type Information
- type LocalCommitRef
- type MailContent
- type OrgInformation
- type Organisation
- type ProviderIndex
- type Repo
- type RepoInformation
- type Setting
- type SlackAttachment
- type SlackAttachmentField
- type SlackMessage
- type SlackTypeLink
- type UserNotification
- type UserPage
- type Version
Constants ¶
const GithubProvider = "github"
GithubProvider ..
const GitlabProvider = "gitlab"
GitlabProvider ..
Variables ¶
This section is empty.
Functions ¶
func CompareLink ¶
CompareLink ..
func InitSession ¶
func InitSession()
InitSession registers and everything related to the user's session
func Stringify ¶
func Stringify(anyStruct interface{}) string
Stringify attempts to create a reasonable string representation of types. It does things like resolve pointers to their values and omits struct fields with nil values. This is taken from Stringify method of go-github. License can be found at https://github.com/google/go-github/blob/master/LICENSE
func WebhooksList ¶
func WebhooksList() []string
WebhooksList is used while displaying list of webhooks specific integrations available
Types ¶
type AppConfig ¶
type AppConfig struct {
ServerProto string `yaml:"serverProto"` // can be http:// or https://
ServerHost string `yaml:"serverHost"` // domain.com with port . Used at redirection for OAuth
LocalHost string `yaml:"localHost"` // host:port combination used for starting the server
DataDir string `yaml:"dataDir"` // relative path from server to write the data
SettingsFile string `yaml:"settingsFile"` // name of file to be looked up/saved to for data
FromName string `yaml:"fromName"` // name of from email user
FromEmail string `yaml:"fromEmail"` // email address of from email address
GithubAPIEndPoint string `yaml:"githubAPIEndPoint"` // server endpoint with protocol for https://api.github.com
GithubURLEndPoint string `yaml:"githubURLEndPoint"` // website end point https://github.com
GitlabAPIEndPoint string `yaml:"gitlabAPIEndPoint"` // server endpoint with protocol for https://gitlab.com/api/v3/
GitlabURLEndPoint string `yaml:"gitlabURLEndPoint"` // website end point https://gitlab.com
SMTPHost string `yaml:"smtpHost"`
SMTPPort int `yaml:"smtpPort"`
SMTPSesConfSet string `yaml:"sesConfigurationSet"` // ses configuration set used as a custom header while sending email
GoogleAnalytics string `yaml:"googleAnalytics"`
SMTPUser string // environment variable
SMTPPass string // environment variable
CacheMode bool `yaml:"cacheMode"` // when cacheMode is false, views are loaded on every request
WebhookIntegrations []string `yaml:"webhookIntegrations"`
StatHatKey string `yaml:"stathatKey"`
StatHatEnvironment string `yaml:"stathatEnvironment"` // Environment string is used to track Stats in StatHatKey
TemplateDir string `yaml:"templateDir"` // tmpl/
TemplatePartialsDir string `yaml:"templatePartialsDir"` // tmpl/partials/
Providers map[string]string // List of ProviderNames that are configured as per auth
SourceCodeLink string
}
AppConfig is
type Authentication ¶
type Authentication struct {
Provider string `yaml:"provider"` // github/gitlab
Name string `yaml:"name"` // name of the person addressing to
Email string `yaml:"email"` // email that we will send to
UserName string `yaml:"username"` // username for identification
Token string `yaml:"token"` // used to query the provider
}
Authentication data/$provider/$user/$settingsFile
func (*Authentication) UserInfo ¶
func (userInfo *Authentication) UserInfo() string
UserInfo provides provider/username
type CacheWriter ¶
type CacheWriter struct {
// contains filtered or unexported fields
}
CacheWriter is the struct to store data temporarily
func (*CacheWriter) Header ¶
func (cw *CacheWriter) Header() http.Header
Header delegates from the original
func (*CacheWriter) SetCachePath ¶
func (cw *CacheWriter) SetCachePath(path string)
SetCachePath sets the cache path and cachable to true
func (*CacheWriter) WriteFromCache ¶
func (cw *CacheWriter) WriteFromCache() bool
WriteFromCache writes to the writer if it could successfully get from cache
func (*CacheWriter) WriteHeader ¶
func (cw *CacheWriter) WriteHeader(code int)
WriteHeader writes the headers
type CacheWriterIface ¶
CacheWriterIface should be used to set the cache params SetCachePath should be set before Write() is ever called WriteFromCache will write to the writer directly . returns true when written from cache all status writes >= 400 are treated as uncachable
type Frequency ¶
type Frequency struct {
TimeZone string `yaml:"tz"`
TimeZoneName string `yaml:"tzname"`
// Minute string // 0-59 allowed
Hour string `yaml:"hour"` // Hour - 0-23 allowed
// MonthDay string // 1-31 allowed. Ignore if you want to use weekday vs weekend
// Month - cannot be set
WeekDay string `yaml:"weekday"` // 0-6 to point SUN-SAT
}
Frequency is the cron format along with a TimeZone to process Minute, Monthday and Month cannot be controlled. Consider them to be '*'
type GitClient ¶
type GitClient interface{}
GitClient is used to abstract out github vs gitlab client
type GitRefWithCommit ¶
GitRefWithCommit contains branch or tag name with Commit
type GitRemoteIface ¶
type GitRemoteIface interface {
// Helper methods
WebsiteLink() string
RepoLink(string) string
TreeLink(string, string) string
CommitLink(string, string) string
CompareLink(string, string, string) string
// Methods containing logic
Branches(string) ([]*GitRefWithCommit, error)
Tags(string) ([]*GitRefWithCommit, error)
SearchRepos(string) ([]*searchRepoItem, error)
SearchUsers(string) ([]*searchUserItem, error)
DefaultBranch(string) (string, error)
BranchesWithoutRefs(string) ([]string, error)
RemoteOrgType(string) (string, error)
ReposForUser(string) ([]*searchRepoItem, error)
}
GitRemoteIface defines the list of methods
type Information ¶
type Information struct {
Repo RepoInformation `yaml:",inline"`
Org OrgInformation `yaml:",inline"`
Type string `yaml:"type"` // type is either Org or Repo
}
Information has the type and contains either Org or Repo Information. This is more of an interface/abstract role based on type
func (*Information) UnmarshalYAML ¶
func (i *Information) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML overrides the default unmarshaling logic
type LocalCommitRef ¶
LocalCommitRef is of the form map[BranchName] = "1234567890abcdef"
type MailContent ¶
type MailContent struct {
WebsiteURL string
User string // provider/username
Name string
Data []*gnDiffData
SavedFile string
}
MailContent ..
type OrgInformation ¶
type OrgInformation struct {
OrgType string `yaml:"org_type,omitempty"`
Repos []string `yaml:"repos,omitempty,flow"`
}
OrgInformation is info for org and ref_type
type Organisation ¶
Organisation is a user/org that is being tracked
type ProviderIndex ¶
ProviderIndex is used for setting up the providers
type Repo ¶
type Repo struct {
Repo string `yaml:"repo"`
NamedReferences []reference `yaml:"commits"`
Branches bool `yaml:"new_branches"`
Tags bool `yaml:"new_tags"`
Provider string
}
Repo is a repository that is being tracked
type RepoInformation ¶
type RepoInformation struct {
Tags []string `yaml:"tags,omitempty,flow"`
Branches []string `yaml:"branches,omitempty,flow"`
Commits LocalCommitRef `yaml:"commits,omitempty"`
}
RepoInformation is all the information fetched from remote location, updated and saved contains the fetched_info
type Setting ¶
type Setting struct {
Version `yaml:"version"`
Repos []*Repo `yaml:"repos"`
Orgs []*Organisation `yaml:"orgs"`
Auth *Authentication `yaml:"auth"`
User *UserNotification `yaml:"user_notification"`
Info map[string]*Information `yaml:"fetched_info"`
}
Setting is the data structure that has all the details
data/$provider/$username/settings.yml
type SlackAttachment ¶
type SlackAttachment struct {
Fallback string `json:"fallback"`
Title string `json:"title"`
Color string `json:"color,omitempty"`
PreText string `json:"pretext"`
AuthorName string `json:"author_name"`
AuthorLink string `json:"author_link"`
Fields []SlackAttachmentField `json:"fields"`
MarkdownFormat []string `json:"mrkdwn_in"`
Text string `json:"text"`
ThumbnailURL string `json:"thumb_url,omitempty"`
}
SlackAttachment ..
type SlackAttachmentField ¶
type SlackAttachmentField struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"short"`
}
SlackAttachmentField ..
type SlackMessage ¶
type SlackMessage struct {
Username string `json:"username"`
Text string `json:"text"`
Attachments []SlackAttachment `json:"attachments"`
}
SlackMessage ..
type SlackTypeLink ¶
SlackTypeLink ..
func (*SlackTypeLink) String ¶
func (s *SlackTypeLink) String() string
<http://www.amazon.com|Amazon>
type UserNotification ¶
type UserNotification struct {
Email string `yaml:"email"`
Name string `yaml:"name"`
Disabled bool `yaml:"disabled"`
Frequency `yaml:",inline"`
WebhookURL string `yaml:"webhook_url"`
WebhookType string `yaml:"webhook_type"`
}
UserNotification is the customization/scheduling is provided for user NOTE: this can be an array of notifications like email, Webhook options. not gonna make the change to the array