summaryrefslogtreecommitdiff
path: root/plugins/static/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-21 13:25:36 +0300
committerValery Piashchynski <[email protected]>2021-01-21 13:25:36 +0300
commit7da6c78449776e1f3c6716250bca0b712a0423a4 (patch)
treef3512de66aca2bba408485a0ea2fc936c0e4fb9b /plugins/static/plugin.go
parent0ff05b2732b4fd0783f959c94c54d7e39169f979 (diff)
Uniform all configs
Add debug server Check nil's for all plugin intialization
Diffstat (limited to 'plugins/static/plugin.go')
-rw-r--r--plugins/static/plugin.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/static/plugin.go b/plugins/static/plugin.go
index 6331037c..fa2bcfbe 100644
--- a/plugins/static/plugin.go
+++ b/plugins/static/plugin.go
@@ -29,11 +29,18 @@ type Plugin struct {
// misconfiguration. Services must not be used without proper configuration pushed first.
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
const op = errors.Op("static_plugin_init")
+ if !cfg.Has(RootPluginName) {
+ return errors.E(op, errors.Disabled)
+ }
err := cfg.UnmarshalKey(RootPluginName, &s.cfg)
if err != nil {
return errors.E(op, errors.Disabled, err)
}
+ if s.cfg.Static == nil {
+ return errors.E(op, errors.Disabled)
+ }
+
s.log = log
s.root = http.Dir(s.cfg.Static.Dir)