Commit 081dd4296c7fa34f5e60ffc8c34d3fff855f8e2a
1 parent
d51114bd
配置文件梳理
Showing
5 changed files
with
38 additions
and
9 deletions
Show diff stats
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +root = "./" | ||
2 | +logger = "server.log" | ||
3 | +harbor = 0 | ||
4 | +start = "main" -- main script | ||
5 | +bootstrap = "snlua bootstrap" -- The service for bootstrap | ||
6 | +lua_path = root .."skynet/lualib/?.lua;"..root.."src/?.lua;"..root.."tools/?.lua" | ||
7 | +luaservice = root.."skynet/service/?.lua;"..root.."src/?.lua" | ||
8 | +lualoader = "skynet/lualib/loader.lua" | ||
9 | +preload = "./src/preload.lua" -- run preload.lua before every lua service run | ||
10 | +cpath = root.."skynet/cservice/?.so" | ||
11 | +lua_cpath = "skynet/luaclib/?.so" | ||
12 | +cluster = "./config/nodenames.lua" | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +include("basic.lua") | ||
2 | + | ||
3 | +logd = 0 -- 是否开启日志 | ||
4 | +thread = 4 | ||
5 | +codeurl = "106.13.60.20:9090" | ||
6 | +servId = 1 | ||
7 | + | ||
8 | +max_client = 64 | ||
9 | + | ||
10 | +server_port = 12001 | ||
11 | +debug_port = 10001 | ||
12 | +httpweb_port = 8001 | ||
13 | + | ||
14 | +redis_host = "127.0.0.1" | ||
15 | +redis_port = 6100 | ||
16 | +redis_db = 1 | ||
17 | +redis_auth = nil |
src/nodenames.lua renamed to config/nodenames.lua
src/main.lua
1 | local skynet = require "skynet" | 1 | local skynet = require "skynet" |
2 | 2 | ||
3 | -local max_client = 64 | 3 | +local max_client = skynet.getenv("max_client") |
4 | 4 | ||
5 | skynet.start(function() | 5 | skynet.start(function() |
6 | print("Server start") | 6 | print("Server start") |
7 | - skynet.newservice("debug_console", 10001) | 7 | + skynet.newservice("debug_console", skynet.getenv("debug_port")) |
8 | 8 | ||
9 | - local httpd = skynet.newservice("services/httpweb", 8001) | 9 | + local httpd = skynet.newservice("services/httpweb", skynet.getenv("httpweb_port")) |
10 | local watchdog = skynet.newservice("services/watchdog", max_client) | 10 | local watchdog = skynet.newservice("services/watchdog", max_client) |
11 | 11 | ||
12 | skynet.call(watchdog, "lua", "start", { | 12 | skynet.call(watchdog, "lua", "start", { |
13 | - port = 12001, | 13 | + port = skynet.getenv("server_port"), |
14 | maxclient = max_client, | 14 | maxclient = max_client, |
15 | httpd = httpd, | 15 | httpd = httpd, |
16 | 16 | ||
17 | - redishost = "127.0.0.1", | ||
18 | - redisport = 6100, | ||
19 | - redisdb = 1, | ||
20 | - auth = nil, | 17 | + redishost = skynet.getenv("redis_host"), |
18 | + redisport = skynet.getenv("redis_port"), | ||
19 | + redisdb = skynet.getenv("redis_db"), | ||
20 | + auth = skynet.getenv("redis_auth"), | ||
21 | }) | 21 | }) |
22 | 22 | ||
23 | skynet.exit() | 23 | skynet.exit() |