@@ -15,6 +15,7 @@ import (
1515 "github.com/cozy/cozy-stack/pkg/appfs"
1616 "github.com/cozy/cozy-stack/pkg/config/config"
1717 "github.com/cozy/cozy-stack/pkg/consts"
18+ "github.com/cozy/cozy-stack/pkg/couchdb"
1819 "github.com/cozy/cozy-stack/pkg/hooks"
1920 "github.com/cozy/cozy-stack/pkg/logger"
2021 "github.com/cozy/cozy-stack/pkg/prefixer"
@@ -46,7 +47,7 @@ type Installer struct {
4647 db prefixer.Prefixer
4748 endState State
4849
49- overridenParameters * json. RawMessage
50+ overridenParameters map [ string ] interface {}
5051 permissionsAcked bool
5152
5253 man Manifest
@@ -73,7 +74,7 @@ type InstallerOptions struct {
7374 // Used to override the "Parameters" field of konnectors during installation.
7475 // This modification is useful to allow the parameterization of a konnector
7576 // at its installation as we do not have yet a registry up and running.
76- OverridenParameters * json. RawMessage
77+ OverridenParameters map [ string ] interface {}
7778}
7879
7980// Fetcher interface should be implemented by the underlying transport
@@ -203,15 +204,24 @@ func initManifest(db prefixer.Prefixer, opts *InstallerOptions) (man Manifest, e
203204 switch opts .Type {
204205 case consts .WebappType :
205206 man = & WebappManifest {
206- DocID : consts .Apps + "/" + slug ,
207- DocSlug : slug ,
207+ doc : & couchdb.JSONDoc {
208+ Type : consts .Apps ,
209+ M : map [string ]interface {}{
210+ "_id" : consts .Apps + "/" + slug ,
211+ },
212+ },
208213 }
209214 case consts .KonnectorType :
210215 man = & KonnManifest {
211- DocID : consts .Konnectors + "/" + slug ,
212- DocSlug : slug ,
216+ doc : & couchdb.JSONDoc {
217+ Type : consts .Konnectors ,
218+ M : map [string ]interface {}{
219+ "_id" : consts .Konnectors + "/" + slug ,
220+ },
221+ },
213222 }
214223 }
224+ man .SetSlug (slug )
215225 } else {
216226 man , err = GetBySlug (db , slug , opts .Type )
217227 if err != nil {
@@ -436,7 +446,7 @@ func (i *Installer) update() error {
436446 i .man .SetState (i .endState )
437447 } else {
438448 if i .man .AppType () == consts .WebappType {
439- i .man .(* WebappManifest ).oldServices = i .man .(* WebappManifest ).Services
449+ i .man .(* WebappManifest ).oldServices = i .man .(* WebappManifest ).val . Services
440450 }
441451 i .man .SetSource (i .src )
442452 if availableVersion != "" {
@@ -510,7 +520,7 @@ func (i *Installer) ReadManifest(state State) (Manifest, error) {
510520 i .src .Scheme != "registry" )
511521 if shouldOverrideParameters {
512522 if m , ok := newManifest .(* KonnManifest ); ok {
513- m .Parameters = i .overridenParameters
523+ m .val . Parameters = i .overridenParameters
514524 }
515525 }
516526
0 commit comments