File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,9 +79,31 @@ function Ensure-SynapseConfig {
7979 New-Item - ItemType Directory - Force - Path $dataPath | Out-Null
8080 $configPath = Join-Path $dataPath ' homeserver.yaml'
8181 if (-not (Test-Path - LiteralPath $configPath )) {
82- & docker run -- rm - v " ${dataPath} :/data" `
83- - e " SYNAPSE_SERVER_NAME=$ServerName " - e SYNAPSE_REPORT_STATS= no `
84- $synapseImage generate
82+ $dockerRunArguments = @ (' run' , ' --rm' )
83+ if (-not [System.Runtime.InteropServices.RuntimeInformation ]::IsOSPlatform(
84+ [System.Runtime.InteropServices.OSPlatform ]::Windows
85+ )) {
86+ $userId = (& id - u).Trim()
87+ if ($LASTEXITCODE -ne 0 -or $userId -notmatch ' ^\d+$' ) {
88+ throw ' Could not determine the Unix user ID for Matrix spike setup'
89+ }
90+ $groupId = (& id - g).Trim()
91+ if ($LASTEXITCODE -ne 0 -or $groupId -notmatch ' ^\d+$' ) {
92+ throw ' Could not determine the Unix group ID for Matrix spike setup'
93+ }
94+ $dockerRunArguments += @ (' --user' , " ${userId} :${groupId} " )
95+ }
96+ $dockerRunArguments += @ (
97+ ' -v' ,
98+ " ${dataPath} :/data" ,
99+ ' -e' ,
100+ " SYNAPSE_SERVER_NAME=$ServerName " ,
101+ ' -e' ,
102+ ' SYNAPSE_REPORT_STATS=no' ,
103+ $synapseImage ,
104+ ' generate'
105+ )
106+ & docker @dockerRunArguments
85107 if ($LASTEXITCODE -ne 0 ) { throw " Failed to generate Synapse config for $ServerName " }
86108
87109 Add-Content - LiteralPath $configPath - Value @"
You can’t perform that action at this time.
0 commit comments