fix: config loading local path error (#26)

* fix: config loading local path error

* test: add config test case
diff --git a/apisix/main.py b/apisix/main.py
index ce8e7db..00ae269 100644
--- a/apisix/main.py
+++ b/apisix/main.py
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+import os
 import click
 
 from apisix.runner.server.server import Server as NewServer
@@ -31,7 +32,7 @@
 
 @runner.command()
 def start() -> None:
-    config = NewConfig()
+    config = NewConfig(os.path.dirname(os.path.abspath(__file__)))
     server = NewServer(config)
     server.receive()
 
diff --git a/apisix/runner/server/config.py b/apisix/runner/server/config.py
index f3c09cf..9e9f4a9 100644
--- a/apisix/runner/server/config.py
+++ b/apisix/runner/server/config.py
@@ -79,15 +79,17 @@
 
 class Config:
 
-    def __init__(self, config_name: str = "config.yaml"):
+    def __init__(self, config_path: str = "", config_name: str = "config.yaml"):
         """
         init config
+        :param config_path:
+            local config file path
         :param config_name:
             local config file name
         """
         self.socket = _ConfigSocket()
         self.logging = _ConfigLogging()
-        self._loading_config(config_name)
+        self._loading_config(config_path, config_name)
 
     @staticmethod
     def _get_env_config(config: str):
@@ -101,13 +103,17 @@
             return os.getenv(env_name)
         return config
 
-    def _loading_config(self, config_name: str):
+    def _loading_config(self, config_path: str, config_name: str):
         """
         load local configuration file
+        :param config_path:
         :param config_name:
         :return:
         """
-        abs_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+        if len(config_path) and os.path.exists(config_path):
+            abs_path = config_path
+        else:
+            abs_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
         cf_path = "%s/%s" % (abs_path, config_name)
         if not os.path.exists(cf_path):
             print("ERR: config file `%s` not exists" % cf_path)
diff --git a/tests/runner/server/test_config.py b/tests/runner/server/test_config.py
index 56df878..a5df767 100644
--- a/tests/runner/server/test_config.py
+++ b/tests/runner/server/test_config.py
@@ -15,11 +15,12 @@
 # limitations under the License.
 #
 
+import os
 import logging
 from apisix.runner.server.config import Config as NewServerConfig
 
 
-def test_config():
+def test_config_default():
     config = NewServerConfig()
 
     config.logging.level = "INFO"
@@ -36,3 +37,22 @@
 
     config.socket.file = "/test/runner.sock"
     assert config.socket.file == "/test/runner.sock"
+
+
+def test_config_custom():
+    config = NewServerConfig("%s/apisix" % os.path.abspath(os.path.join(os.getcwd())), "config.yaml")
+
+    config.logging.level = "NOTSET"
+    assert config.logging.level == logging.NOTSET
+
+    config.logging.level = "INFO"
+    assert config.logging.level == logging.INFO
+
+    config.logging.level = "ERROR"
+    assert config.logging.level == logging.ERROR
+
+    config.logging.level = "WARN"
+    assert config.logging.level == logging.WARNING
+
+    config.socket.file = "/test/runner.sock"
+    assert config.socket.file == "/test/runner.sock"