From 766eac185a56e5c6831f622e63d7837aa3b96076 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Mon, 4 Dec 2017 16:05:18 +0100 Subject: [PATCH] Move configuration to a separate file, require parameter. Refers to #13 --- AutoTx/Resources/Update-AutoTxService.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/AutoTx/Resources/Update-AutoTxService.ps1 b/AutoTx/Resources/Update-AutoTxService.ps1 index b754d70..933cd80 100644 --- a/AutoTx/Resources/Update-AutoTxService.ps1 +++ b/AutoTx/Resources/Update-AutoTxService.ps1 @@ -2,12 +2,20 @@ # AutoTx service binaries and configuration file -# ------------------------------------------------------------------------------ -$InstallationPath = "C:\Tools\AutoTx" -$ServiceName = "AutoTx" +[CmdletBinding()] +Param( + [Parameter(Mandatory=$True)][string] $UpdaterSettings +) + +try { + . $UpdaterSettings +} +catch { + $ex = $_.Exception.Message + Write-Host "Error reading settings file: '$($UpdaterSettings)' [$($ex)]" + Exit +} -$UpdateSourcePath = "C:\ATX\TARGET\d-vamp-dw\_AUTOTX_" -# ------------------------------------------------------------------------------ function Check-ServiceState([string]$ServiceName) { -- GitLab