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

Multiple Configuration Handling #41

Open
scrthq opened this issue Jul 15, 2020 · 0 comments
Open

Multiple Configuration Handling #41

scrthq opened this issue Jul 15, 2020 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@scrthq
Copy link
Member

scrthq commented Jul 15, 2020

Thanks for all your help so far.

I notice the variables under $PSProfile.Variables.Environment aren't clobbered if the PSProfile configuration is imported by leveraging the $PSProfile.ConfigurationPaths. However they are clobbered if I import using Import-PSProfileConfiguration.

It seems the benefit of using Import-PSProfileConfiguration is that the $PSProfile object is immediately updated within the user's current session. Whereas if I just modify the ConfigurationPaths property, not all the properties (if any) in $PSProfile seem to be updated immediately, even after triggering Update-PSProfileConfig and Refresh-PSProfile.

I'm trying to devise a workflow that enables quick install of my PSProfile configuration and easy update too. An ideal workflow for install and update would work like:

  1. Download PSProfile.Configuration.psd1 from my repo/Gist to somewhere like ~
  2. Import-PSProfileConfiguration ~\PSProfile.Configuration.psd1
  3. Use Add-PSProfilePrompt or similar to modify $PSProfile, or modify the configuration file directly, and use Export-PSProfileConfiguration. Update my repo/Gist with newly exported psd1.
  4. Invoke some custom function that I'll likely store as an init script e.g. Update-Profile that will pull my PSProfile.Configuration.psd1 from my repo or Gist and update ~\PSProfile.Configuration.psd1. Said function will use Import-PSProfileConfiguration once downloaded because it immediately updates $PSProfile without needing to reload.

The problem for me is in step 3, I don't want manually strip out user and machine specific properties before uploading to some location. There's more than just what's under $PSProfile.Variables.Environment which is machine and user specific too, e.g.

  • PluginPaths
  • Settings.ConfigurationPath

I have an idea which might help but I'm not sure how to create in PSProfile. What if Export-PSProfileConfiguration offered some parameter to exclude named properties? That could get a little tricky for usage for the user, e.g. how would they specify child properties such as $PSProfile.Settings.ConfigurationPath in the parameter. But it's probably the most flexible idea because if you just offered a switch instead -ExcludeMachineUserSpecificInfo (terrible name I know, but stick with me) then this means you're deciding for the user what properties they can only exclude with little flexibility.

However, maybe I shouldn't be using Import-PSProfileConfiguration after download and maybe I should just ensure $PSProfile.ConfigurationPaths includes ~\PSProfile.Configuration.psd1 and just reload my session if a new version is detected. What's your opinion?

Originally posted by @codaamok in #37 (comment)

@scrthq scrthq self-assigned this Jul 15, 2020
@scrthq scrthq added the question Further information is requested label Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant