Skip to content

Commit

Permalink
Refactor to start working on #48
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Oct 4, 2020
1 parent 5fffed3 commit 8adbb2c
Show file tree
Hide file tree
Showing 33 changed files with 571 additions and 657 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ to your NAS, server or computer.

![](.res/screenshot.png)

💡 Want to be notified of new releases? Check out 🔔 [Diun (Docker Image Update Notifier)](https://github.com/crazy-max/diun) project!

## Documentation

Documentation can be found on https://crazy-max.github.io/ftpgrab/
Expand Down
11 changes: 5 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import (
"github.com/crazy-max/ftpgrab/v7/internal/app"
"github.com/crazy-max/ftpgrab/v7/internal/config"
"github.com/crazy-max/ftpgrab/v7/internal/logging"
"github.com/crazy-max/ftpgrab/v7/internal/model"
"github.com/rs/zerolog/log"
)

var (
ftpgrab *app.FtpGrab
cli model.Cli
cli config.Cli
version = "dev"
meta = model.Meta{
meta = config.Meta{
ID: "ftpgrab",
Name: "FTPGrab",
Desc: "Grab your files periodically from a remote FTP or SFTP server easily",
Expand Down Expand Up @@ -61,7 +60,7 @@ func main() {
}

// Init
logging.Configure(&cli, location)
logging.Configure(cli, location)
log.Info().Str("version", version).Msgf("Starting %s", meta.Name)

// Handle os signals
Expand All @@ -75,14 +74,14 @@ func main() {
}()

// Load configuration
cfg, err := config.Load(cli.Cfgfile, cli.Schedule)
cfg, err := config.Load(cli, meta)
if err != nil {
log.Fatal().Err(err).Msg("Cannot load configuration")
}
log.Debug().Msg(cfg.String())

// Init
if ftpgrab, err = app.New(meta, cfg, location); err != nil {
if ftpgrab, err = app.New(cfg, location); err != nil {
log.Fatal().Err(err).Msgf("Cannot initialize %s", meta.Name)
}

Expand Down
Loading

0 comments on commit 8adbb2c

Please sign in to comment.