@@ -181,20 +181,22 @@ func runDump(ctx *cli.Context) error {
181181 }
182182 fileName += "." + outType
183183 }
184- setting .LoadFromExisting ()
184+ setting .InitProviderFromExistingFile ()
185+ setting .LoadCommonSettings ()
185186
186187 // make sure we are logging to the console no matter what the configuration tells us do to
187- if _ , err := setting .Cfg .Section ("log" ).NewKey ("MODE" , "console" ); err != nil {
188+ // FIXME: don't use CfgProvider directly
189+ if _ , err := setting .CfgProvider .Section ("log" ).NewKey ("MODE" , "console" ); err != nil {
188190 fatal ("Setting logging mode to console failed: %v" , err )
189191 }
190- if _ , err := setting .Cfg .Section ("log.console" ).NewKey ("STDERR" , "true" ); err != nil {
192+ if _ , err := setting .CfgProvider .Section ("log.console" ).NewKey ("STDERR" , "true" ); err != nil {
191193 fatal ("Setting console logger to stderr failed: %v" , err )
192194 }
193195 if ! setting .InstallLock {
194196 log .Error ("Is '%s' really the right config path?\n " , setting .CustomConf )
195197 return fmt .Errorf ("gitea is not initialized" )
196198 }
197- setting .NewServices () // cannot access session settings otherwise
199+ setting .LoadSettings () // cannot access session settings otherwise
198200
199201 stdCtx , cancel := installSignals ()
200202 defer cancel ()
@@ -322,7 +324,7 @@ func runDump(ctx *cli.Context) error {
322324 log .Info ("Packing data directory...%s" , setting .AppDataPath )
323325
324326 var excludes []string
325- if setting .Cfg . Section ( "session" ). Key ( "PROVIDER" ). Value () == "file" {
327+ if setting .SessionConfig . OriginalProvider == "file" {
326328 var opts session.Options
327329 if err = json .Unmarshal ([]byte (setting .SessionConfig .ProviderConfig ), & opts ); err != nil {
328330 return err
@@ -339,7 +341,7 @@ func runDump(ctx *cli.Context) error {
339341 excludes = append (excludes , setting .LFS .Path )
340342 excludes = append (excludes , setting .Attachment .Path )
341343 excludes = append (excludes , setting .Packages .Path )
342- excludes = append (excludes , setting .LogRootPath )
344+ excludes = append (excludes , setting .Log . RootPath )
343345 excludes = append (excludes , absFileName )
344346 if err := addRecursiveExclude (w , "data" , setting .AppDataPath , excludes , verbose ); err != nil {
345347 fatal ("Failed to include data directory: %v" , err )
@@ -378,12 +380,12 @@ func runDump(ctx *cli.Context) error {
378380 if ctx .IsSet ("skip-log" ) && ctx .Bool ("skip-log" ) {
379381 log .Info ("Skip dumping log files" )
380382 } else {
381- isExist , err := util .IsExist (setting .LogRootPath )
383+ isExist , err := util .IsExist (setting .Log . RootPath )
382384 if err != nil {
383- log .Error ("Unable to check if %s exists. Error: %v" , setting .LogRootPath , err )
385+ log .Error ("Unable to check if %s exists. Error: %v" , setting .Log . RootPath , err )
384386 }
385387 if isExist {
386- if err := addRecursiveExclude (w , "log" , setting .LogRootPath , []string {absFileName }, verbose ); err != nil {
388+ if err := addRecursiveExclude (w , "log" , setting .Log . RootPath , []string {absFileName }, verbose ); err != nil {
387389 fatal ("Failed to include log: %v" , err )
388390 }
389391 }
0 commit comments