jamplay-common
v4.3.0
Published
This package include reuse module in jamplay web project
Downloads
10
Readme
Jamplay common module
This package include reuse module in jamplay web project
Config
There are 3 config type in Jamplay plattform
- Server Runtime Config (confident)
- Public Runtime Config (public, permanently config string)
- Remote Runtime Config (public, dynamtic config string)
Remote config setup
There are some serveral step to setup Remote Config
Requirement
- NAP_URL: because main Content data is NAP remote config need graphql endpoint to resolve it
- In
_document.js
: get config from remote and merge with__NEXT_DATA__
import getConfig from 'jamplay-common/remote-config'
.... in Document
public static getInitialProps(ctx) {
return {
remoteConfig: getConfig().remoteRuntimeConfig
}
}
constructor(props) {
super(props)
props.__NEXT_DATA__.remoteRuntimeConfig = props.remoteConfig
}
Or you can use
jamplay-common/client/_document
as your_document
class
- initial RemoteConfig singleton server
- when your server start, init your server singleton config by
call
init
await init(config.NAP_GRAPHQL_URI)