API urls moved to CLI parameters.

This commit is contained in:
Alexey Skobkin 2016-03-25 18:23:40 +03:00
parent 3e4cabcaf4
commit f1d46ca56c

View file

@ -11,11 +11,14 @@ import (
)
func main() {
var pointApiUrl, pointToolsApiUrl string;
var pointLogin, pointPassword, pointToolsToken string
flag.StringVar(&pointLogin, "l", "", "Account login")
flag.StringVar(&pointPassword, "p", "", "Account password")
flag.StringVar(&pointToolsToken, "t", "", "Point Tools crawler API token")
flag.StringVar(&pointApiUrl, "s", "https://point.im/api/", "Point.im API url")
flag.StringVar(&pointToolsApiUrl, "g", "https://point.skobk.in/api/crawler/", "Point Tools API url")
flag.Parse()
if len(pointLogin) < 1 || len(pointPassword) < 1 {
@ -28,8 +31,8 @@ func main() {
return
}
pointClient := point.NewClient("https://point.im/api/")
pointToolsClient := point_tools.NewClient("http://point-tools.local:8000/api/crawler/", pointToolsToken)
pointClient := point.NewClient(pointApiUrl)
pointToolsClient := point_tools.NewClient(pointToolsApiUrl, pointToolsToken)
_, loginErr := pointClient.Login(pointLogin, pointPassword)