diff options
author | crupest <crupest@outlook.com> | 2020-06-12 18:39:24 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-12 18:39:24 +0800 |
commit | cc62df19e5f8aa216660915f46ff290c8eeab1d0 (patch) | |
tree | 4b96cfe4613edacbd6b5e94d0b74d25bebeb1387 /Timeline/Services/PathProvider.cs | |
parent | 45993fadcc7a4e40acfb75bd0baa19c1354395da (diff) | |
download | timeline-cc62df19e5f8aa216660915f46ff290c8eeab1d0.tar.gz timeline-cc62df19e5f8aa216660915f46ff290c8eeab1d0.tar.bz2 timeline-cc62df19e5f8aa216660915f46ff290c8eeab1d0.zip |
refactor(backend): Move some string constant from PathProvider to ApplicationConfiguration.
Diffstat (limited to 'Timeline/Services/PathProvider.cs')
-rw-r--r-- | Timeline/Services/PathProvider.cs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Timeline/Services/PathProvider.cs b/Timeline/Services/PathProvider.cs index eefbf41a..ac7cd800 100644 --- a/Timeline/Services/PathProvider.cs +++ b/Timeline/Services/PathProvider.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Configuration;
using System.IO;
+using Timeline.Configs;
namespace Timeline.Services
{
@@ -11,8 +12,6 @@ namespace Timeline.Services public class PathProvider : IPathProvider
{
- const string DatabaseFileName = "timeline.db";
-
private readonly IConfiguration _configuration;
private readonly string _workingDirectory;
@@ -21,7 +20,7 @@ namespace Timeline.Services public PathProvider(IConfiguration configuration)
{
_configuration = configuration;
- _workingDirectory = configuration.GetValue<string?>("WorkDir") ?? "/timeline";
+ _workingDirectory = configuration.GetValue<string?>(ApplicationConfiguration.WorkDirKey) ?? ApplicationConfiguration.DefaultWorkDir;
}
public string GetWorkingDirectory()
@@ -31,7 +30,7 @@ namespace Timeline.Services public string GetDatabaseFilePath()
{
- return Path.Combine(_workingDirectory, DatabaseFileName);
+ return Path.Combine(_workingDirectory, ApplicationConfiguration.DatabaseFileName);
}
}
}
|