aboutsummaryrefslogtreecommitdiff
path: root/content/resources/backup/gen_config.sh
blob: 225df999bdbfdb216625a38f1ea7001f7f832ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash

. $(dirname $1)/./$(basename $1)
OUTFILE=$2
BACKUP_NAME=$3

if test "x${PCA_OS_REGION_NAME}" = x; then
  PCA_OS_REGION_NAME=${OS_REGION_NAME}
fi

if test "x${HOT_OS_REGION_NAME}" = x; then
  HOT_OS_REGION_NAME=${OS_REGION_NAME}
fi

envsubst > "${OUTFILE}" << EOF
[
    {
        "description": "Cold storage",
        "url": "pca://${BACKUP_NAME}",
        "env": [
            {
                "name": "PCA_AUTHURL",
                "value": "${OS_AUTH_URL}"
            },
            {
                "name": "PCA_AUTHVERSION",
                "value": "${OS_IDENTITY_API_VERSION}"
            },
            {
                "name": "PCA_PROJECT_DOMAIN_NAME",
                "value": "Default"
            },
            {
                "name": "PCA_TENANTID",
                "value": "${OS_TENANT_ID}"
            },
            {
                "name": "PCA_USERNAME",
                "value": "${OS_USERNAME}"
            },
            {
                "name": "PCA_PASSWORD",
                "value": "${OS_PASSWORD}"
            },
            {
                "name": "PCA_REGIONNAME",
                "value": "${PCA_OS_REGION_NAME}"
            }
        ],
        "prefixes": ["cold_"]
    },
    {
        "description": "Hot storage",
        "url": "swift://${BACKUP_NAME}_indexes",
        "env": [
            {
                "name": "SWIFT_AUTHURL",
                "value": "${OS_AUTH_URL}"
            },
            {
                "name": "SWIFT_AUTHVERSION",
                "value": "${OS_IDENTITY_API_VERSION}"
            },
            {
                "name": "SWIFT_PROJECT_DOMAIN_NAME",
                "value": "${OS_PROJECT_DOMAIN_NAME}"
            },
            {
                "name": "SWIFT_TENANTID",
                "value": "${OS_TENANT_ID}"
            },
            {
                "name": "SWIFT_USERNAME",
                "value": "${OS_USERNAME}"
            },
            {
                "name": "SWIFT_PASSWORD",
                "value": "${OS_PASSWORD}"
            },
            {
                "name": "SWIFT_REGIONNAME",
                "value": "${HOT_OS_REGION_NAME}"
            }
        ],
        "prefixes": ["hot_"]
    }
]
EOF