kaelzhang / ctrip-apollo Goto Github PK
View Code? Open in Web Editor NEWThe most delightful and handy Node.js client for ctrip apollo configuration service.
License: Other
The most delightful and handy Node.js client for ctrip apollo configuration service.
License: Other
apollo 1.6.0版本后,终于增加支持了对获取应用配置时启用密钥鉴权,希望ctrip-apollo可以尽快支持
I installed node v11.6.0 and tried to run the demo as below, but got the error message: SyntaxError: await is only valid in async function
, which looks like something's missing...
Test Code:
const apollo = require('ctrip-apollo')
const app = apollo({
host: 'http://106.12.25.204:8080',
appId: '100004458'
})
// Get the default namespace
const namespace = app.namespace()
// Namespace is an EventEmitter of nodejs
.on('change', ({
key,
oldValue,
newValue
}) => {
// Updates new values to `process.env`
process.env[key] = newValue
})
// - Fetch configurations for the first time
// - start update notification polling (by default)
await namespace.ready()
console.log(namespace.get('timeout'))
Error Message:
await namespace.ready()
^^^^^
SyntaxError: await is only valid in async function
at new Script (vm.js:84:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:312:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
The dependency request
has been deprecated, please see request/request#3142
Could you replace this dependency with another library? such as node-fetch
, thank you!
const {DEFAULT_POLLING_RETRY_POLICY} = require('./polling') DEFAULT_POLLING_RETRY_POLICY值为undefined。为什么要使用呢?
The local cache file is configured. The generated local cache file is a file whose name is encrypted by base64 and has no file type. It is difficult to read. If you can customize or default .properties or .json, it is also a good choice.
你好,请问支持多个namespace配置么?
谢谢
No .json suffix added to the URL when get json namespace config.
But it's added when polling update.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.