rabin 7 years ago
parent
commit
9c1b1e13d8
3 changed files with 59 additions and 4 deletions
  1. 0 3
      conf/dev.conf
  2. 55 0
      conf/env.conf
  3. 4 1
      demeter.py

+ 0 - 3
demeter.conf → conf/dev.conf

@@ -18,7 +18,6 @@ tsdb				= influxdb
 
 [mqtt]
 host				= 0.0.0.0
-;host				= iot-emq
 port				= 1883
 username			= admin
 password			= public
@@ -28,7 +27,6 @@ topic				= method/type/gateway/device
 
 [postgresql]
 host				= 0.0.0.0
-;host				= iot-pgsql
 port				= 5432
 username			= postgres
 password			= 123456
@@ -39,7 +37,6 @@ create				= True
 
 [influxdb]
 host				= 0.0.0.0
-;host				= iot-influx
 port				= 8086
 username			= root
 password			= root

+ 55 - 0
conf/env.conf

@@ -0,0 +1,55 @@
+[base]
+
+[setting]
+name				= 农小盒
+;园区默认id,如有cookie,此处的值会自动变成cookie的值
+farm				= 1
+site				= http://www.nongxiaohe.com/
+copyright			= 2017 nongxiaohe.com v1.0.0
+
+
+[gateway]
+;暂时写在这里 网关对应园区id 这里从数据库里读取
+gateway				= 1
+
+[db]
+rdb					= postgresql
+tsdb				= influxdb
+
+[mqtt]
+host				= iot-emq
+port				= 1883
+username			= admin
+password			= public
+timeout				= 60
+;topic定义
+topic				= method/type/gateway/device
+
+[postgresql]
+host				= iot-pgsql
+port				= 5432
+username			= postgres
+password			= 123456
+dbname				= nongxiaohe
+prefix				= demeter
+;允许自动建表
+create				= True
+
+[influxdb]
+host				= iot-influx
+port				= 8086
+username			= root
+password			= root
+dbname				= nongxiaohe
+prefix				= demeter
+
+;后台配置
+[admin]
+port				= 8087
+debug				= True
+;请求的buffersize
+max_buffer_size		= 210763776
+;子进程
+process				= 0
+;top菜单的数据来源
+top 				= farm

+ 4 - 1
demeter.py

@@ -33,7 +33,10 @@ class Demeter(object):
 			PATH = File.path()
 		cls.path = PATH
 		if cls.config == {}:
-			filename = cls.path + 'demeter.conf'
+			name = 'dev'
+			if 'DEMETER_CONF' in os.environ:
+				name = os.environ['DEMETER_CONF']
+			filename = cls.path + 'conf/'+name+'.conf'
 			if File.exists(filename):
 				config = ConfigParser.ConfigParser()
 				config.read(filename)