Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: add support for adding default plugins #3926

Closed
ilgooz opened this issue Jan 3, 2022 · 4 comments
Closed

plugins: add support for adding default plugins #3926

ilgooz opened this issue Jan 3, 2022 · 4 comments
Labels
component:extensions Related to Ignite Extensions. type:feat To implement new feature.
Milestone

Comments

@ilgooz
Copy link
Member

ilgooz commented Jan 3, 2022

Plugin system: #1312, #1959

The plugin system requires you to define the plugins you want to use for your chain in the chain's config.yml. As this is pretty useful for loading plugins optionally, Starport CLI may want to offer some plugins out of the box, without the need of users defining them in the config.yml manually. (maybe starport scaffold band)

In order accomplish this feature, we can define the default plugins in DefaultConf which will make Starport CLI automatically load these plugins without any user input.

cc @tbruyelle

@ilgooz ilgooz changed the title services/plugin: add support for adding default plugins plugins: add support for adding default plugins Jan 3, 2022
@tbruyelle
Copy link
Contributor

I was able to add a default plugin with the following change :

diff --git a/starport/chainconfig/config.go b/starport/chainconfig/config.go
index faa458f2..1789776e 100644
--- a/starport/chainconfig/config.go
+++ b/starport/chainconfig/config.go
@@ -50,6 +50,9 @@ var DefaultConf = Config{
        Faucet: Faucet{
                Host: "0.0.0.0:4500",
        },
+       Plugins: []Plugin{
+               {Name: "test", Path: "git.sr.ht/~tbruyelle/plugins-sp/print"},
+       },
 }
 
 // Config is the user given configuration to do additional setup
@@ -221,7 +224,7 @@ func Parse(r io.Reader) (Config, error) {
        if err := yaml.NewDecoder(r).Decode(&conf); err != nil {
                return conf, err
        }
-       if err := mergo.Merge(&conf, DefaultConf); err != nil {
+       if err := mergo.Merge(&conf, DefaultConf, mergo.WithAppendSlice); err != nil {
                return Config{}, err
        }
        return conf, validate(conf)

That said I'm not sure about the impact of adding the mergo.WithAppendSlice option to the merge operation. Maybe it can have unwanted impact on other fields of the config. WDYT?

@salmad3 salmad3 transferred this issue from ignite/cli Feb 1, 2024
@salmad3 salmad3 transferred this issue from ignite/apps Feb 1, 2024
@salmad3 salmad3 added type:feat To implement new feature. component:extensions Related to Ignite Extensions. labels Feb 2, 2024
@salmad3 salmad3 moved this from Backlog to Todo in Ignite CLI Masterboard Feb 2, 2024
@salmad3 salmad3 added this to the v29 milestone Feb 2, 2024
@Ehsan-saradar
Copy link
Contributor

Ehsan-saradar commented Feb 6, 2024

@salmad3 Don't we already have this feature here?

@tbruyelle
Copy link
Contributor

@salmad3 Don't we already have this feature here?

Yes I think so, the related PR is here #3306.

@salmad3
Copy link
Member

salmad3 commented Feb 6, 2024

Yes, thanks, let's close.

@salmad3 salmad3 closed this as completed Feb 6, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Ignite CLI Masterboard Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:extensions Related to Ignite Extensions. type:feat To implement new feature.
Projects
Status: Done
Development

No branches or pull requests

4 participants