Exemple #1
0
func main() {
	conf := &AppConfig{
		Location:    "Europe/Berlin",
		Lat:         "52.5167",
		Long:        "13.4",
		ForecastKey: os.Getenv("FORECAST_API_KEY"),
		Vbb: &vbb.Vbb{
			os.Getenv("VBB_API_KEY"),
		},
		Jira: gojira.NewJira(
			os.Getenv("JIRA_BASE_URL"),
			os.Getenv("JIRA_API_PATH"),
			"",
			&gojira.Auth{
				os.Getenv("JIRA_LOGIN"),
				os.Getenv("JIRA_PASSWORD"),
			},
		),
		HttpDir:  "/web",
		HttpAddr: ":80",
	}

	http.Handle("/weather.json", AppHandler{conf, weatherHandler})
	http.Handle("/vbb.json", AppHandler{conf, vbbHandler})
	http.Handle("/jira.json", AppHandler{conf, jiraHandler})
	http.Handle("/", http.FileServer(http.Dir(conf.HttpDir)))

	log.Printf("Listening at %s...", conf.HttpAddr)
	log.Fatal(http.ListenAndServe(conf.HttpAddr, nil))
}
Exemple #2
0
func getJiraIssue(issueID string) gojira.Issue {
	jiraAPIPath := "/rest/api/latest"
	jiraActivityPath := ""

	jira := gojira.NewJira(
		getConfig().JiraBaseURL,
		jiraAPIPath,
		jiraActivityPath,
		&gojira.Auth{
			Login:    getConfig().JiraUsername,
			Password: getConfig().JiraPassword,
		},
	)

	issueData := jira.Issue(issueID)

	return issueData
}