Skip to content

Commit

Permalink
Support Elm inspection tool in frontend Elm app
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Feb 12, 2020
1 parent c19144a commit 2facfb9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Expand Up @@ -29,6 +29,8 @@ static public void BuildConfiguration(string[] args)

var loweredElmOutputArgument = argumentValueFromParameterName("--lowered-elm-output");

// TODO: Remove redundancy: Probably move these arguments towards integrating app into the CLI project.

var frontendWebElmMakeCommandAppendix = argumentValueFromParameterName("--frontend-web-elm-make-appendix");

var (configZipArchive, loweredElmAppFiles) = BuildConfigurationZipArchive(frontendWebElmMakeCommandAppendix);
Expand Down
Expand Up @@ -15,6 +15,8 @@ static public class Configuration

static public string WebAppConfigurationFilePathSettingKey => "webAppConfigurationFilePath";

static public string WithSettingFrontendWebElmMakeAppendixSettingKey => "frontendWebElmMakeAppendix";

static public string AdminRootPasswordSettingKey => "adminRootPassword";

static public string AdminRootUserName => "root";
Expand Down Expand Up @@ -43,6 +45,11 @@ static public class Configuration
string webAppConfigurationFilePath) =>
orig.UseSetting(WebAppConfigurationFilePathSettingKey, webAppConfigurationFilePath);

static public IWebHostBuilder WithSettingFrontendWebElmMakeAppendix(
this IWebHostBuilder orig,
string frontendWebElmMakeAppendix) =>
orig.UseSetting(WithSettingFrontendWebElmMakeAppendixSettingKey, frontendWebElmMakeAppendix);

static public IWebHostBuilder WithSettingAdminRootPassword(
this IWebHostBuilder orig,
string adminRootPassword) =>
Expand Down
Expand Up @@ -49,7 +49,8 @@ public void ConfigureServices(IServiceCollection services)
_logger.LogInformation(
"Loading configuration from current directory.");

var (configZipArchive, _) = BuildConfigurationFromArguments.BuildConfigurationZipArchive(null);
var (configZipArchive, _) = BuildConfigurationFromArguments.BuildConfigurationZipArchive(
frontendWebElmMakeCommandAppendix: config.GetValue<string>(Configuration.WithSettingFrontendWebElmMakeAppendixSettingKey));

webAppConfigFileZipArchive = configZipArchive;
}
Expand Down
8 changes: 4 additions & 4 deletions implement/elm-fullstack/Program.cs
Expand Up @@ -29,6 +29,7 @@ static int Main(string[] args)
var processStoreDirectoryPathOption = runServerCmd.Option("--process-store-directory-path", "Directory in the file system to contain the backend process store.", CommandOptionType.SingleValue).IsRequired(allowEmptyStrings: false);
var webAppConfigurationFilePathOption = runServerCmd.Option("--web-app-configuration-file-path", "Path to a file containing the complete configuration in a zip-archive. If you don't use this option, the server uses the current directory as the source.", CommandOptionType.SingleValue);
var deletePreviousBackendStateOption = runServerCmd.Option("--delete-previous-backend-state", "Delete the previous state of the backend process. If you don't use this option, the server restores the last state backend on startup.", CommandOptionType.NoValue);
var frontendWebElmMakeAppendixOption = runServerCmd.Option("--frontend-web-elm-make-appendix", "Arguments to add when using elm make to build the frontend app.", CommandOptionType.SingleValue);
runServerCmd.OnExecute(() =>
{
Expand All @@ -46,10 +47,9 @@ static int Main(string[] args)
webHostBuilder.WithSettingProcessStoreDirectoryPath(processStoreDirectoryPath);
if (webAppConfigurationFilePathOption.HasValue())
{
webHostBuilder.WithSettingWebAppConfigurationFilePath(webAppConfigurationFilePathOption.Value());
}
webHostBuilder.WithSettingWebAppConfigurationFilePath(webAppConfigurationFilePathOption.Value());
webHostBuilder.WithSettingFrontendWebElmMakeAppendix(frontendWebElmMakeAppendixOption.Value());
Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(webHostBuilder.Build());
});
Expand Down

0 comments on commit 2facfb9

Please sign in to comment.