标签:
一种是erl启动的时候加参数
doudizhu.config
[ {doudizhu,[ {listen_port, 7000}, {node_caller_prefix,"ruby"}, {pgsql_ip,"127.0.0.1"}, {pgsql_username,"mmc"}, {pgsql_password,"mmc"}, {pgsql_db,"doudizhu_db"}, {redis_ip,"127.0.0.1"}, {redis_port,6379} ] } ].
run.sh
erl -config doudizhu.config
还有一种是,如果你通过rebar generate生成单独的运行环境,那么可以直接修改sys.config
[ %% SASL config {sasl, [ {sasl_error_logger, {file, "log/sasl-error.log"}}, {errlog_type, error}, {error_logger_mf_dir, "log/sasl"}, % Log directory {error_logger_mf_maxbytes, 10485760}, % 10 MB max file size {error_logger_mf_maxfiles, 5} % 5 files max ]}, "/Users/mmc/Projects/erlang/doudizhu/deploy/conf/doudizhu.config" ].
程序里面获取变量,可以直接通过application:get_env(listen_port)之类的来获取
标签:
原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/4319086.html