2019-03-29 09:31:37 +04:00
|
|
|
// Yandex Disk File Pusher
|
|
|
|
// Copyright (c) 2019 Vladimir "fat0troll" Hodakov
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-03-30 08:07:13 +04:00
|
|
|
"fmt"
|
2019-12-30 04:39:34 +04:00
|
|
|
"source.hodakov.me/fat0troll/yapusher/domains/yandex/v1"
|
|
|
|
"source.hodakov.me/fat0troll/yapusher/internal/context"
|
2019-03-30 08:07:13 +04:00
|
|
|
"runtime/debug"
|
2019-03-29 09:31:37 +04:00
|
|
|
)
|
|
|
|
|
2019-03-30 08:07:13 +04:00
|
|
|
// In production builds these variables are set by goreleaser
|
|
|
|
var (
|
|
|
|
version = "master"
|
|
|
|
commit = "?"
|
|
|
|
date = ""
|
|
|
|
)
|
|
|
|
|
|
|
|
//nolint:gochecknoinits
|
|
|
|
func init() {
|
|
|
|
if info, available := debug.ReadBuildInfo(); available {
|
|
|
|
if date == "" && info.Main.Version != "(devel)" {
|
|
|
|
version = info.Main.Version
|
|
|
|
commit = fmt.Sprintf("(unknown, mod sum: %q)", info.Main.Sum)
|
|
|
|
date = "(unknown)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-29 09:31:37 +04:00
|
|
|
func main() {
|
|
|
|
c := context.New()
|
|
|
|
c.Init()
|
2019-03-30 08:07:13 +04:00
|
|
|
c.Logger.Info().Str("version", version).Str("commit", commit).Str("build date", date).Msg("yapusher is starting")
|
2019-03-29 09:31:37 +04:00
|
|
|
c.InitConfig()
|
|
|
|
|
|
|
|
// Initializing domains
|
|
|
|
yandexv1.New(c)
|
|
|
|
|
|
|
|
// Parsing app flags
|
|
|
|
c.Flagger.Parse()
|
|
|
|
|
|
|
|
// Authorizing to Yandex
|
|
|
|
yandexv1.Process()
|
|
|
|
}
|