config file to volume

This commit is contained in:
Your Name
2017-01-13 11:27:57 +03:00
parent 8330df2ce3
commit 5630fe4946
6 changed files with 45 additions and 3 deletions
+2
View File
@@ -1,6 +1,8 @@
#docker-compose file, because it contains passwords #docker-compose file, because it contains passwords
config.yml config.yml
config.yaml config.yaml
config/config.yaml
config/config.yml
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
-1
View File
@@ -7,6 +7,5 @@ RUN pip install --upgrade pip && pip install -r /requirements.txt
WORKDIR /app WORKDIR /app
COPY src /app COPY src /app
ADD config.yaml /app/
CMD ["python", "-u", "/app/main.py"] CMD ["python", "-u", "/app/main.py"]
-1
View File
@@ -7,6 +7,5 @@ RUN pip install --upgrade pip && pip install -r /requirements.txt
WORKDIR /app WORKDIR /app
COPY src /app COPY src /app
ADD config.yaml /app/
CMD ["python", "-u", "/app/main.py"] CMD ["python", "-u", "/app/main.py"]
+40
View File
@@ -0,0 +1,40 @@
mqtt:
server: 192.168.1.2
port: 1883
username: username
password: passw0rd
prefix: home
gateway:
password: passw0rd
sids:
# motion
158d0000e7c7ad:
model: motion
name: hall
# temperature
158d0001149b3c:
model: sensor_ht
name: living
# plugs
158d00010dd98d:
model: plug
name: heater
# buttons
158d00012d5720:
model: switch
name: kitchen
# cube
158d00011065e3:
model: cube
name: main
# gateway
f0b429aa1463:
model: gateway
name: main
+2
View File
@@ -2,5 +2,7 @@ xiaomi:
build: . build: .
dockerfile: Dockerfile-i386 dockerfile: Dockerfile-i386
container_name: xiaomi container_name: xiaomi
volumes:
- "./config:/app/config"
net: host net: host
restart: always restart: always
+1 -1
View File
@@ -46,7 +46,7 @@ def process_mqtt_messages(gateway, client):
if __name__ == "__main__": if __name__ == "__main__":
_LOGGER.info("Loading config file...") _LOGGER.info("Loading config file...")
config=yamlparser.load_yaml('config.yaml') config=yamlparser.load_yaml('config/config.yaml')
gateway_pass = yamlparser.get_gateway_password(config) gateway_pass = yamlparser.get_gateway_password(config)
_LOGGER.info("Init mqtt client.") _LOGGER.info("Init mqtt client.")