Skip to content

Commit

Permalink
Simplify command-line argument for process store path
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Jun 5, 2021
1 parent 355e6b5 commit 6d96fca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion implement/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ RUN dotnet "/elm-fullstack/dotnet/elm-fs.dll" deploy-app --from=/docker-image-d

WORKDIR /elm-fullstack

ENTRYPOINT ["dotnet", "/elm-fullstack/dotnet/elm-fs.dll", "run-server", "--process-store-directory-path=/elm-fullstack/process-store"]
ENTRYPOINT ["dotnet", "/elm-fullstack/dotnet/elm-fs.dll", "run-server", "--process-store-path=/elm-fullstack/process-store"]

# ENV APPSETTING_adminPassword="password-for-admin-interface"
20 changes: 10 additions & 10 deletions implement/elm-fullstack/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static CommandLineApplication AddRunServerCmd(CommandLineApplication app) =>
string[] publicWebHostUrlsDefault = new[] { "http://*", "https://*" };


var processStoreDirectoryPathOption = runServerCmd.Option("--process-store-directory-path", "Directory in the file system to contain the process store.", CommandOptionType.SingleValue);
var processStorePathOption = runServerCmd.Option("--process-store-path", "Directory in the file system to contain the process store.", CommandOptionType.SingleValue);
var deletePreviousProcessOption = runServerCmd.Option("--delete-previous-process", "Delete the previous backend process found in the given store. If you don't use this option, the server restores the process from the persistent store on startup.", CommandOptionType.NoValue);
var adminUrlsOption = runServerCmd.Option("--admin-urls", "URLs for the admin interface. The default is " + adminUrlsDefault.ToString() + ".", CommandOptionType.SingleValue);
var adminPasswordOption = runServerCmd.Option("--admin-password", "Password for the admin interface at '--admin-urls'.", CommandOptionType.SingleValue);
Expand All @@ -251,7 +251,7 @@ static CommandLineApplication AddRunServerCmd(CommandLineApplication app) =>

runServerCmd.OnExecute(() =>
{
var processStoreDirectoryPath = processStoreDirectoryPathOption.Value();
var processStorePath = processStorePathOption.Value();

var publicAppUrls =
publicAppUrlsOption.Value()?.Split(',').Select(url => url.Trim()).ToArray() ??
Expand All @@ -262,19 +262,19 @@ static CommandLineApplication AddRunServerCmd(CommandLineApplication app) =>
var replicateProcessAdminPassword =
replicateProcessAdminPasswordOption.Value() ?? UserSecrets.LoadPasswordForSite(replicateProcessFrom);

if ((deletePreviousProcessOption.HasValue() || replicateProcessFrom != null) && processStoreDirectoryPath != null)
if ((deletePreviousProcessOption.HasValue() || replicateProcessFrom != null) && processStorePath != null)
{
Console.WriteLine("Deleting the previous process state from '" + processStoreDirectoryPath + "'...");
Console.WriteLine("Deleting the previous process state from '" + processStorePath + "'...");

if (System.IO.Directory.Exists(processStoreDirectoryPath))
System.IO.Directory.Delete(processStoreDirectoryPath, true);
if (System.IO.Directory.Exists(processStorePath))
System.IO.Directory.Delete(processStorePath, true);

Console.WriteLine("Completed deleting the previous process state from '" + processStoreDirectoryPath + "'.");
Console.WriteLine("Completed deleting the previous process state from '" + processStorePath + "'.");
}

IFileStore processStoreFileStore = null;

if (processStoreDirectoryPath == null)
if (processStorePath == null)
{
Console.WriteLine("I got no path to a persistent store for the process. This process will not be persisted!");

Expand Down Expand Up @@ -311,7 +311,7 @@ static CommandLineApplication AddRunServerCmd(CommandLineApplication app) =>
}
else
{
processStoreFileStore = new FileStoreFromSystemIOFile(processStoreDirectoryPath);
processStoreFileStore = new FileStoreFromSystemIOFile(processStorePath);
}

if (replicateProcessFrom != null)
Expand Down Expand Up @@ -355,7 +355,7 @@ static CommandLineApplication AddRunServerCmd(CommandLineApplication app) =>

var initElmAppState =
(deletePreviousProcessOption.HasValue() && !replicateProcessFromOption.HasValue()) ||
processStoreDirectoryPath == null;
processStorePath == null;

var compositionLogEvent =
ElmFullstack.WebHost.ProcessStoreSupportingMigrations.CompositionLogRecordInFile.CompositionEvent.EventForDeployAppConfig(
Expand Down

0 comments on commit 6d96fca

Please sign in to comment.