Skip to content

Application environment configurations support #28

@zdrawku

Description

@zdrawku

Current state:
At the moment, if the OpenAPI schema file has defined servers (environments) App Builder will list them as dropdown options to pick from. Upon app code generation the selected Base URL will be hardcoded in the application files instead of exposing it in a config file/s (example with Blazor below). This leads to problems when there is a need to work on different deploy/build environments.
image

Expected result:
AppBuilder should automatically generate an appsettings.json, appsettings.development.json, or whatever is defined for each environment (Blazor-specific example). Any generated application should be ready to plug into a build and release pipeline if needed. In order to achieve that, App Builder should provide a UI to set the environment name, which will be used for the application settings environment files/configurations (based on the Framework).

For Blazor that would be appsettings.{Environment}.json configurations
image

For Angular environment.{env-name}.ts file
image

Based on the framework, other changes should be considered, not only the configuration files, but also:

  • Angular, for example, would be the target-specific files, building and serving configurations, and so on.
  • Blazor, for example is having app settings per environment. This means we need to set the environment variable on the server-side either by setting the ASPNETCORE_ENVIRONMENT environment variable or the blazor-environment response header. For Blazor Wasm, there is a boot script that loads the appsettings.json and appsettings.{Environment}.json file corresponding to the blazer-environment received and populate the WebAssemblyHostBuilder.Configuration with data in those files. We can then configure components, services, or js.

You can then configuration to your components, services or js

Looking at the OpenAPI spec docs, using of variables is something that we can explore to use the typed-in values from the UI:
image

Notes:
A UI for Specifying server (env) names is required as the OpenAPI spec doesn't provide a way to define server name, except the description field and we cannot use a clear pattern on doing this automatically based on provided Data Schema.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions