aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/windows/telegraf_password.ps1
blob: 36a4f523bc8fd42d853586aeacb4b94c72ab5464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Copyright (C) 2019 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

. "$PSScriptRoot\helpers.ps1"

$auth_file = "C:\Users\qt\work\influxdb\coin_vms_writer.auth"

# Provisioning should run even without the secrets repository
if (Test-Path $auth_file) {
    $auth_content = Get-Content $auth_file
    $influxdb_password = $auth_content.Substring($auth_content.LastIndexOf(':') + 1)
    Remove "$auth_file"
} else {
    $influxdb_password = "no_password_provided"
}

$telegraf_conf = "C:\telegraf-coin.conf"
(Get-Content $telegraf_conf) | ForEach-Object { $_.Replace("COIN_VMS_WRITER_PASS", $influxdb_password) } | Out-File -Encoding UTF8 $telegraf_conf