Default config
Register plugin's default config
What is defaultConfig?
defaultConfig is an object you can register with your Plugin to make sure that your plugin will have some default config value when a user install/update your plugin in Dashboard
import DashboardPlugin from 'Dashboard/plugin'
const Plugin = new DashboardPlugin('@plugin_bundle')
const registerPlugin = () => {
const { Application } = require('@components/Application')
Plugin.register({
application: Application,
defaultConfig: {
applicationKey: 'xxxx-xx-xxxxx-x-xxx'
}
})
}
registerPlugin()
export {
Plugin
}
The object keys should be the ref keys of your config field.
In our example 👆🏽we registered a default config object with a key applicationKey
that means in the Settings component, the ref who has the same key applicationKey
will share the same value and it will be assigned as a default value for that ref
import { Plugin } from '@root'
const GUI = Plugin.GUI
class Settings extends Plugin.settings {
plugin() {
return (
<div>
<GUI.ConfigInput
name={'Application key'}
ref={refs => this.handleRefs(refs, 'applicationKey')}
/>
</div>
)
}
}
Last updated
Was this helpful?