From f65698c5879657c13c50be03245b4c0a623dba83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sun, 24 Feb 2019 23:39:55 +0100 Subject: [PATCH] automatically add the rpc php part to the url --- configs/defaultConfig.ini | 2 +- internal/app/app.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/defaultConfig.ini b/configs/defaultConfig.ini index 6ce353f..0226890 100644 --- a/configs/defaultConfig.ini +++ b/configs/defaultConfig.ini @@ -3,5 +3,5 @@ allowUnknownFlags = false # Don't terminate the app if ini file contains unknow configUpdateInterval = 0s # Update interval for re-reading config file set via -config flag. Zero disables config file re-reading. imagesRootPath = # This is the images root path that should be mirrored to piwigo. piwigoPassword = # This is password to the given username. -piwigoUrl = # The root url to your piwigo installation. +piwigoUrl = # The root url without tailing slash to your piwigo installation. piwigoUser = # The username to use during sync. diff --git a/internal/app/app.go b/internal/app/app.go index 0166798..7168214 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -3,6 +3,7 @@ package app import ( "errors" "flag" + "fmt" "github.com/sirupsen/logrus" "haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/localFileStructure" "haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/authentication" @@ -11,7 +12,7 @@ import ( var ( imagesRootPath = flag.String("imagesRootPath", "", "This is the images root path that should be mirrored to piwigo.") - piwigoUrl = flag.String("piwigoUrl", "", "The root url to your piwigo installation.") + piwigoUrl = flag.String("piwigoUrl", "", "The root url without tailing slash to your piwigo installation.") piwigoUser = flag.String("piwigoUser", "", "The username to use during sync.") piwigoPassword = flag.String("piwigoPassword", "", "This is password to the given username.") ) @@ -87,7 +88,7 @@ func configureContext() (*AppContext, error) { context := new(AppContext) context.LocalRootPath = *imagesRootPath context.Piwigo = new(authentication.PiwigoContext) - context.Piwigo.Url = *piwigoUrl + context.Piwigo.Url = fmt.Sprintf("%s/ws.php?format=json", *piwigoUrl) context.Piwigo.Username = *piwigoUser context.Piwigo.Password = *piwigoPassword