Used secrets file to distinguish development vs. deployment
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import argparse
|
||||
from util import DeviceInfo, add_to_group
|
||||
from ruamel.yaml import YAML
|
||||
import knx_conf as knx
|
||||
@@ -113,7 +114,7 @@ def add_light_groups(groups):
|
||||
groups.update(light_groups)
|
||||
|
||||
|
||||
def create_config(target_directory):
|
||||
def create_config(target_directory, development=False):
|
||||
groups_yaml_path = os.path.join(script_path, 'groups.yaml')
|
||||
manual_config_path = os.path.join(script_path, 'manual_config.yaml')
|
||||
group_dict = yaml.load(open(groups_yaml_path))
|
||||
@@ -132,6 +133,16 @@ def create_config(target_directory):
|
||||
output.write("# Dont' edit manually! this is generated!\n\n")
|
||||
yaml.dump(group_dict, output)
|
||||
|
||||
with open(os.path.join(target_directory, 'secrets.yaml'), 'w') as output:
|
||||
output.write("# Dont' edit manually! this is generated!\n\n")
|
||||
output.write(open(os.path.join(script_path, 'secrets.yaml'), 'r').read())
|
||||
output.write("\n\n")
|
||||
additional_file = 'secrets_development.yaml' if development else 'secrets_deploy.yaml'
|
||||
output.write(open(os.path.join(script_path, additional_file), 'r').read())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_config(target_directory=os.getcwd())
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-d", "--dev", help="create config file for development", action="store_true")
|
||||
args = parser.parse_args()
|
||||
create_config(target_directory=os.getcwd(), development=args.dev)
|
||||
|
||||
@@ -54,19 +54,20 @@ cover_half:
|
||||
|
||||
tts:
|
||||
- platform: watson_tts
|
||||
watson_apikey: X_tnnoaZGOwxZlqUn07wkD2G-0vaaAuOw6I6d_6jpCf7
|
||||
watson_apikey: !secret watson_api_key
|
||||
watson_url: https://gateway-lon.watsonplatform.net/text-to-speech/api
|
||||
voice: de-DE_BirgitVoice
|
||||
output_format: audio/flac
|
||||
output_audio_rate: 44100
|
||||
|
||||
|
||||
knx:
|
||||
rate_limit: 20
|
||||
tunneling:
|
||||
host: server # knxd to work together with old home automation server
|
||||
#host: 192.168.178.65 # network bridge
|
||||
host: !secret knxd_host
|
||||
port: 3671
|
||||
local_ip: 192.168.178.76
|
||||
local_ip: !secret local_ip
|
||||
|
||||
|
||||
fhem:
|
||||
host: server
|
||||
@@ -91,7 +92,7 @@ media_player:
|
||||
vacuum:
|
||||
- platform: xiaomi_miio
|
||||
host: rockrobo
|
||||
token: 515a69497537766d4f7a38756b4b654d
|
||||
token: !secret local_ip
|
||||
|
||||
|
||||
group: !include groups.yaml
|
||||
|
||||
3
config_creation/secrets.yaml
Normal file
3
config_creation/secrets.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
vacuum_token: 515a69497537766d4f7a38756b4b654d
|
||||
watson_api_key: X_tnnoaZGOwxZlqUn07wkD2G-0vaaAuOw6I6d_6jpCf7
|
||||
knxd_host: server #directly the network bridge: 192.168.178.65
|
||||
1
config_creation/secrets_deploy.yaml
Normal file
1
config_creation/secrets_deploy.yaml
Normal file
@@ -0,0 +1 @@
|
||||
local_ip: 192.168.178.80
|
||||
1
config_creation/secrets_development.yaml
Normal file
1
config_creation/secrets_development.yaml
Normal file
@@ -0,0 +1 @@
|
||||
local_ip: 192.168.178.76
|
||||
Reference in New Issue
Block a user