Apply configuration profiles from an environment variable - #339
Merged
Conversation
Allow deployments to provision a configuration profile (settings, packages, package sources) without user interaction, composing with the existing OneWareStudio.defaults.json deployment defaults. ONEWARE_CONFIGURATION_PROFILE accepts a local file path or an http(s) URL, so a profile can be served centrally. It can be set through the defaults file, as a real environment variable, or via the new --configuration-profile argument. Profiles are applied once by default, tracked by a SHA-256 fingerprint of the source and content, so a deployment default does not overwrite settings the user changed afterwards. Editing the profile or repointing the variable re-applies it. ONEWARE_CONFIGURATION_PROFILE_MODE=always re-applies on every launch for locked-down deployments. A profile that cannot be downloaded or parsed is logged and skipped so it can never prevent the IDE from starting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Lets a deployment provision a configuration profile — settings, packages, and package sources — without any user interaction, composing with the existing
OneWareStudio.defaults.jsondeployment defaults.Configuration profiles could previously only be applied by hand through Extras → Import Configuration..., which doesn't fit an automated rollout. Setting
ONEWARE_CONFIGURATION_PROFILEnow applies one at startup.Usage
The value is a local file path or an
http(s)URL, so a profile can be served centrally and updated without touching each machine. It can be provided three ways:EnvironmentDefaultsServicealready loads anyONEWARE_-prefixed key, so the defaults file works with no change to that class.Applied once, not on every launch
Re-importing on every start would silently revert settings the user changed afterwards. Instead the service records a SHA-256 fingerprint of
source + profile contentinAppDataDirectory:ONEWARE_CONFIGURATION_PROFILE_MODE=always→ re-applied unconditionally, for locked-down deployments where enforcement is the goal.Failure handling
A missing file, unreachable URL, or malformed JSON is logged and skipped — it can never prevent the IDE from starting. Only
OperationCanceledExceptionpropagates. Packages already installed are left untouched.Implementation notes
IConfigurationProfileServicegainsLoadFromSourceAsync(path or URL) andApplyEnvironmentProfileAsync; the variable names are exposed as constants on the interface.ConfigurationProfileServicenow takesIHttpServiceto fetch remote profiles.LoadContentAsyncimmediately afterRegisterPackageRepositoryWithFallback, so package sources contributed by the profile are registered beforeImportPackagesAsyncruns its ownRefreshAsyncand can resolve packages from them.Known limitation
Settings consumed during early startup — GPU cache size and X11 rendering mode, read in
BuildAvaloniaApp— are read before the profile is applied, so those take effect on the next launch. Documented in the README rather than restructuring startup ordering.Testing
alwaysmode, and the missing-profile path.dotnet test OneWare.slnx— 96 tests pass across 11 projects, 0 failures.dotnet buildclean onOneWare.Studio.Desktop.