apollo -s http://*****:** -a {appid} -o "{output}" -w
apollo -h
Usage: apollo [options]
Options:
-V, --version output the version number
-t, --template [template] 默认的配置模版 , 可以为空 (default: )
-o, --output [output] 输出文件地址 (default: apollo-config.json)
-a, --appId [appId] 请求的appId , 必填 (default: )
-c, --cluster [cluster] 请求的集群 , 默认是 `default` (default: default)
-n, --namespace [namespace] 请求的命名空间 , 必填 (default: application)
-w, --watch [watch] 是否开启监听改变 , 默认false (default: false)
-s, --serve [serve] 请求服务地址 , 必填 (default: )
-h, --help output usage information
import apo from "apolloagent";
const agent = apo({
appId: "{appid}",
serve: "http:/****:**"
});
agent.requestFromCache();
agent.requestFromNoCache();
agent.shortPoll();
agent.longPoll();
agent.on("change", function(data) {
console.log(data);
});
agent.writeConfigFile("", "./test/ss.json", true);