Skip to content

ValheimPlus sample config with environment variables #409

Answered by patrickdomnick
henrysachs asked this question in Q&A
Discussion options

You must be logged in to vote

I did something in PowerShell

function Get-IniContent ($filePath)
{
    $ini = @{}
    switch -regex -file $FilePath
    {
        "^\[(.+)\]" # Section
        {
            $section = $matches[1]
            $ini[$section] = @{}
            $CommentCount = 0
        }
        "^(;.*)$" # Comment
        {
            $value = $matches[1]
            $CommentCount = $CommentCount + 1
            $name = "Comment" + $CommentCount
            $ini[$section][$name] = $value
        }
        "(.+?)\s*=(.*)" # Key
        {
            $name,$value = $matches[1..2]
            $ini[$section][$name] = $value
        }
    }
    return $ini
}

$conf = Get-IniContent("valheim_plus.cfg")
$lines = @

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@henrysachs
Comment options

@syntaxintact
Comment options

Answer selected by henrysachs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants