4
0
mirror of https://github.com/QuasarApp/QuasarAppCI.git synced 2025-04-28 14:44:36 +00:00

28 lines
660 B
Python
Raw Normal View History

2019-07-22 16:56:56 +03:00
# This Python file uses the following encoding: utf-8
import json
from pathlib import Path
2019-12-26 11:29:22 +03:00
2019-07-22 16:56:56 +03:00
class SecretManager:
2021-04-06 00:33:46 +03:00
def __init__(self, jsFile, properties=None):
contents = Path(jsFile).read_text()
self.jsfile = json.loads(contents)
self.prop = properties
2019-09-26 17:23:13 +03:00
2019-07-22 16:56:56 +03:00
def getValue(self, key):
2021-04-06 00:33:46 +03:00
value = self.jsfile[key]
if self.prop:
self.prop.useSecret(value, key)
return value
2021-05-19 11:45:09 +03:00
def convertToCmakeDefines(self):
defines = []
2021-05-19 12:00:39 +03:00
for key in self.jsfile:
2021-05-19 12:17:51 +03:00
defineString = str('-D' + key + '=' + self.getValue(key))
2021-05-19 12:22:20 +03:00
defines.append(defineString)
2021-05-19 11:45:09 +03:00
return defines