Skip to content

Instantly share code, notes, and snippets.

@nyanhp
Last active November 19, 2018 17:50
Show Gist options
  • Save nyanhp/90bbdf328d26eb4b126a25b718d39073 to your computer and use it in GitHub Desktop.
Save nyanhp/90bbdf328d26eb4b126a25b718d39073 to your computer and use it in GitHub Desktop.
<#
Both files for my tests simply contained
{ bla = 'value }
and
{ bla = 'UserDefinedValue' }
#>
$d = @"
ResolutionPrecedence:
- $(Join-Path -Path $home -ChildPath 'AutomatedLab\settings.psd1')
- $(Join-Path (Get-Module AutomatedLab -List)[0].ModuleBase 'Datum\settings.psd1')
default_lookup_options: MostSpecific
merge_hash: Unique
merge_baseType_array: Unique
merge_hash_array: DeepTuple
DatumStructure:
- StoreName: Settings
StoreProvider: Datum::File
StoreOptions:
Path: $(Join-Path (Get-Module AutomatedLab -List)[0].ModuleBase 'Datum\settings.psd1')
- StoreName: Settings
StoreProvider: Datum::File
StoreOptions:
Path: $(Join-Path -Path $home -ChildPath 'AutomatedLab\settings.psd1')
"@ | ConvertFrom-Yaml
$datum = New-DatumStructure -DatumHierarchyDefinition $d
@gaelcolas
Copy link

try this yaml instead (adapting few bits maybe):

ResolutionPrecedence:
  - $(Join-Path -Path $home -ChildPath 'AutomatedLab\settings.psd1')
  - $(Join-Path (Get-Module AutomatedLab -List)[0].ModuleBase 'Datum\settings.psd1')
default_lookup_options: hash
lookup_options:
  Settings:
    merge_hash: deep

DatumStructure:
  - StoreName: Settings
    StoreProvider: Datum::File
    StoreOptions:
      Path: $(Join-Path (Get-Module AutomatedLab -List)[0].ModuleBase 'Datum\settings.psd1')
  - StoreName: Settings
    StoreProvider: Datum::File
    StoreOptions:
      Path: $(Join-Path -Path $home -ChildPath 'AutomatedLab\settings.psd1')

@gaelcolas
Copy link

for reference: https://github.com/gaelcolas/Datum#lookup-merging-behaviour

lookup_options:
  <Key Name>: MostSpecific/First|hash/MergeTopKeys|deep/MergeRecursively
  <Other Key>:
    merge_hash: MostSpecific/First|deep|hash/*
    merge_basetype_array: MostSpecific/First|Sum/Add|Unique
    merge_hash_array: MostSpecific/First|Sum|DeepTuple/DeepItemMergeByTuples|UniqueKeyValTuples
    merge_options:
      knockout_prefix: --
      tuple_keys:
        - Name
        - Version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment