Used secrets file to distinguish development vs. deployment

This commit is contained in:
Martin Bauer 2019-06-30 22:15:52 +02:00
parent 28e3b77c15
commit 383973c255
11 changed files with 33 additions and 16 deletions

2
.gitignore vendored
View File

@ -8,4 +8,4 @@ node_modules
/groups.yaml
/configuration.yaml
/home-assistant_v2.db
/secrets.yaml

View File

@ -57,7 +57,7 @@
"created_at": "2019-05-28T15:36:44.634951+00:00",
"id": "952866338b694f5b806eb4cdb8fd19f4",
"jwt_key": "fb1989218b2d6690fc17636866615d04f53352c179ded55cfc4d7d509c1c8354b17088f51a016b14e9b851a6faae274bf0f83fb7049bd0707c435f23113f3316",
"last_used_at": "2019-06-30T18:30:19.144896+00:00",
"last_used_at": "2019-06-30T19:59:11.266552+00:00",
"last_used_ip": "192.168.178.71",
"token": "5f7f4f3e8063e4e74570095749ec752bc1b74b26f6e4c20d0fe219753339e9d5ac44e2582d02257a9e2dc9116a79f668350bbad81dabd21ff52b08a109a2f5d8",
"token_type": "normal",

View File

@ -1,7 +1,7 @@
{
"data": [
{
"last_seen": "2019-06-30T19:44:11.001489+00:00",
"last_seen": "2019-06-30T20:14:56.454572+00:00",
"state": {
"attributes": {
"editable": true,

View File

@ -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)

View File

@ -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

View 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

View File

@ -0,0 +1 @@
local_ip: 192.168.178.80

View File

@ -0,0 +1 @@
local_ip: 192.168.178.76

6
run.sh
View File

@ -1,6 +0,0 @@
#!/bin/bash
./make_config.sh
./make_custom_frontend.sh
python -m homeassistant --config /config

6
run_on_server.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
./make_config.sh server
./make_custom_frontend.sh
python -m homeassistant --config /config

View File