config
简介
如果启动参数中有--global
参数, 则读取对应文件, 添加到global参数中
组件接口
config.gs
函数原型 | 函数作用 |
---|---|
void load(mixed val, mixed schema = nil) | add_global_opts 的别名 |
void add_global_opts(mixed val, mixed schema = nil) | 通过文件或者map, 批量增加 global 参数 |
void add_global_opt(string name, mixed val) | 添加单个全局参数 |
string boot_opt(string name) | 获取启动参数, 在启动命令行通过 --script-args 指定 |
mixed global_opt(string name) | 获取全局参数 |
mixed opt(string name) | 优先获取启动参数, 如果启动参数不存在, 获取全局设置 |
mixed query(string name) | 通过路径获取配置项 |
void set(string name, mixed val) | 通过路径设置配置项 |
class_map get_by_class_map(class_map a, string key = nil) | 通过 class map 里面已有的项 读取配置 |
map get_global_config() | 获取全部的配置项 |