Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppSettings capability #13

Open
6 tasks
JeremyCaney opened this issue Oct 4, 2019 · 0 comments
Open
6 tasks

Add AppSettings capability #13

JeremyCaney opened this issue Oct 4, 2019 · 0 comments
Labels
Area: Web Relates to the `AspNetCore` or other web-related functionality. Priority: 3 Status 0: Discussion Needs further evaluation of requirements and prioritization. Type: Feature Introduces a major area of functionality.

Comments

@JeremyCaney
Copy link
Member

JeremyCaney commented Oct 4, 2019

Create an OnTopic AppSettings configuration store that can be used to store global settings such as (non-secret) API keys or site-wide preferences.

Current Approach

Today, customers store application settings in a variety of places:

  • config files (such as web.config or appsettings.config)
  • secrets.json files (in development) and Azure App Service Settings (in production)
  • Individual Topic classes, if it's not a secret (see below)
  • Startup, if it's not a secret

Some sites even use a combination of each of these.

Topic-Based Approach

Given the nature of OnTopic as a semi-structured data source, it makes sense for OnTopic sites to be configured via Topics. Today, this is done on a per Topic basic, typically as a subclass of Page. That's fine for one-off pages, such as a /Search page storing an API key, but it's impractical for values that need to be shared across multiple pages, as configuration settings are only available in that context.

Ideal Approach

Ideally, we'll instead approach this through something like the following:

  • ContentTypeDescriptor: AppSettings (LookupList)
    • TopicList: Settings of AppSettingsItem (LookupListItem)
    • AllowedContentTypes: AppSettings (thus allowing namespacing)
  • Root:Configuration:AppSettings as root store
  • TopicAppSettings (IConfiguration) class for storing, retrieving settings
  • TopicConfiguration class for mapping TopicAppSettings to a value object and passing it to e.g. AddTopicSupport().

This way, any custom application setting can easily be added to OnTopic without needing to create a custom ContentTypeDescriptor, and those application settings can easily be namespaced in case a particular context (such as /Search) has multiple settings.

@JeremyCaney JeremyCaney self-assigned this Oct 4, 2019
JeremyCaney added a commit to GoldSim/Website that referenced this issue Oct 5, 2019
In the original **ASP.NET WebForms** implementation of **OnTopic**, we have a strongly typed configuration section that allowed easy access via `ConfigurationManager`. This approach is no longer used by Microsoft—and, besides, we don't actually really use most of these settings anymore. While some of these may be useful to reintroduce at some point, we'll want to do so through either `appSettings.json` or a custom `IConfiguration` provider—such as that proposed in **OnTopic** itself (OnTopicCMS/OnTopic-Library#13).
@JeremyCaney JeremyCaney added Area: Web Relates to the `AspNetCore` or other web-related functionality. Status 0: Discussion Needs further evaluation of requirements and prioritization. Type: Feature Introduces a major area of functionality. Priority: 3 and removed enhancement labels Mar 4, 2021
@JeremyCaney JeremyCaney modified the milestone: OnTopic 6.0.0 Mar 12, 2021
@JeremyCaney JeremyCaney removed their assignment Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Web Relates to the `AspNetCore` or other web-related functionality. Priority: 3 Status 0: Discussion Needs further evaluation of requirements and prioritization. Type: Feature Introduces a major area of functionality.
Projects
None yet
Development

No branches or pull requests

1 participant