Jelajahi Sumber

Merge pull request #1202 from emqtt/develop

Add test case for hot configuration
Feng Lee 8 tahun lalu
induk
melakukan
a22ecaf1f1
2 mengubah file dengan 34 tambahan dan 1 penghapusan
  1. 8 1
      src/emqttd_config.erl
  2. 26 0
      test/emqttd_config_SUITE.erl

+ 8 - 1
src/emqttd_config.erl

@@ -15,6 +15,13 @@
 %%--------------------------------------------------------------------
 
 %% @doc Hot Configuration
+%%
+%% TODO: How to persist the configuration?
+%% 
+%% 1. Store in mnesia database?
+%% 2. Store in dets?
+%% 3. Store in data/app.config?
+%%
 
 -module(emqttd_config).
 
@@ -25,7 +32,7 @@
 %% @doc Read the configuration of an application.
 -spec(read(atom()) -> {ok, list(env())} | {error, term()}).
 read(_App) ->
-    %% TODO
+    %% TODO: 
     %% 1. Read the app.conf from etc folder
     %% 2. Cuttlefish to read the conf
     %% 3. Return the terms and schema

+ 26 - 0
test/emqttd_config_SUITE.erl

@@ -0,0 +1,26 @@
+%%--------------------------------------------------------------------
+%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io)
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%%     http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%--------------------------------------------------------------------
+
+-module(emqttd_config_SUITE).
+
+-compile(export_all).
+
+-include("emqttd.hrl").
+
+all() -> [].
+
+groups() -> [].
+