From ff00ca9f0a200013f33b355586ea65f4554e4438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sun, 24 Feb 2019 01:17:10 +0100 Subject: [PATCH] format and function visibility fixed --- internal/app/app.go | 34 +++++++++---------- .../piwigo/authentication/authentication.go | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index 030cbd8..85d0460 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -7,7 +7,7 @@ import ( ) func Run(rootPath string) { - context := ConfigureContext(rootPath) + context := configureContext(rootPath) loginToPiwigoAndConfigureContext(context) @@ -22,22 +22,6 @@ func Run(rootPath string) { authentication.Logout(context.Piwigo) } -func ConfigureContext(rootPath string) *AppContext { - logrus.Infoln("Preparing application context and configuration") - - context := new(AppContext) - context.LocalRootPath = rootPath - context.Piwigo = new(authentication.PiwigoContext) - - //TODO: Move this values to configuration files - //No, these are not real credentials :-P - context.Piwigo.Url = "http://pictures.haefelfinger.net/ws.php?format=json" - context.Piwigo.Username = "admin" - context.Piwigo.Password = "asdf" - - return context -} - func ScanLocalDirectories(context *AppContext) { var fileNodes map[string]localFileStructure.FilesystemNode = localFileStructure.ScanLocalFileStructure(context.LocalRootPath) for _, node := range fileNodes { @@ -67,6 +51,22 @@ func UploadImages() { logrus.Warnln("Uploading missing images (NotImplemented)") } +func configureContext(rootPath string) *AppContext { + logrus.Infoln("Preparing application context and configuration") + + context := new(AppContext) + context.LocalRootPath = rootPath + context.Piwigo = new(authentication.PiwigoContext) + + //TODO: Move this values to configuration files + //No, these are not real credentials :-P + context.Piwigo.Url = "http://pictures.haefelfinger.net/ws.php?format=json" + context.Piwigo.Username = "admin" + context.Piwigo.Password = "asdf" + + return context +} + func loginToPiwigoAndConfigureContext(context *AppContext) { logrus.Infoln("Logging in to piwigo and getting chunk size configuration for uploads") authentication.Login(context.Piwigo) diff --git a/internal/pkg/piwigo/authentication/authentication.go b/internal/pkg/piwigo/authentication/authentication.go index 0475792..4c4c8ba 100644 --- a/internal/pkg/piwigo/authentication/authentication.go +++ b/internal/pkg/piwigo/authentication/authentication.go @@ -14,7 +14,7 @@ func Login(context *PiwigoContext) { logrus.Debugf("Logging in to %s using user %s", context.Url, context.Username) - if !strings.HasPrefix(context.Url,"https") { + if !strings.HasPrefix(context.Url, "https") { logrus.Warnf("The server url %s does not use https! Credentials are not encrypted!", context.Url) }