Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/recyclarr/commit/38b6ab513185d6bd13cbf3b0d1eabfe4052ab6b7?style=split&whitespace=show-all You should set ROOT_URL correctly, otherwise the web may not work correctly.

fix: Fix IAppPaths access issue in create-config

pull/76/head
Robert Dailey 3 years ago
parent 85b1abc035
commit 38b6ab5131

@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed
- Exception when running `create-config` command.
## [2.1.0] - 2022-05-29 ## [2.1.0] - 2022-05-29
### Added ### Added

@ -5,6 +5,7 @@ using CliFx.Exceptions;
using CliFx.Infrastructure; using CliFx.Infrastructure;
using Common; using Common;
using JetBrains.Annotations; using JetBrains.Annotations;
using Recyclarr.Command.Initialization;
using Serilog; using Serilog;
using TrashLib; using TrashLib;
@ -16,40 +17,40 @@ public class CreateConfigCommand : ICommand
{ {
private readonly IFileSystem _fs; private readonly IFileSystem _fs;
private readonly IAppPaths _paths; private readonly IAppPaths _paths;
private readonly IDefaultAppDataSetup _appDataSetup;
private readonly ILogger _log; private readonly ILogger _log;
private string? _path;
public CreateConfigCommand(ILogger logger, IFileSystem fs, IAppPaths paths) public CreateConfigCommand(ILogger logger, IFileSystem fs, IAppPaths paths, IDefaultAppDataSetup appDataSetup)
{ {
_log = logger; _log = logger;
_fs = fs; _fs = fs;
_paths = paths; _paths = paths;
_appDataSetup = appDataSetup;
} }
[CommandOption("path", 'p', Description = [CommandOption("path", 'p', Description =
"Path where the new YAML file should be created. Must include the filename (e.g. path/to/config.yml). " + "Path where the new YAML file should be created. Must include the filename (e.g. path/to/config.yml). " +
"File must not already exist. If not specified, uses the default path of `recyclarr.yml` right next to the " + "File must not already exist. If not specified, uses the default path of `recyclarr.yml` in the app data " +
"executable.")] "directory")]
public string Path public string? Path { get; set; }
{
get => _path ?? _paths.ConfigPath;
set => _path = value;
}
public ValueTask ExecuteAsync(IConsole console) public ValueTask ExecuteAsync(IConsole console)
{ {
_appDataSetup.SetupDefaultPath();
var reader = new ResourceDataReader(typeof(Program)); var reader = new ResourceDataReader(typeof(Program));
var ymlData = reader.ReadData("config-template.yml"); var ymlData = reader.ReadData("config-template.yml");
var path = Path ?? _paths.ConfigPath;
if (_fs.File.Exists(Path)) if (_fs.File.Exists(path))
{ {
throw new CommandException($"The file {Path} already exists. Please choose another path or " + throw new CommandException($"The file {path} already exists. Please choose another path or " +
"delete/move the existing file and run this command again."); "delete/move the existing file and run this command again.");
} }
_fs.Directory.CreateDirectory(_fs.Path.GetDirectoryName(Path)); _fs.Directory.CreateDirectory(_fs.Path.GetDirectoryName(path));
_fs.File.WriteAllText(Path, ymlData); _fs.File.WriteAllText(path, ymlData);
_log.Information("Created configuration at: {Path}", Path); _log.Information("Created configuration at: {Path}", path);
return default; return default;
} }
} }

Loading…
Cancel
Save