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

Potential issues with plugin config file settings #144

Open
timkelty opened this issue Jun 4, 2018 · 10 comments
Open

Potential issues with plugin config file settings #144

timkelty opened this issue Jun 4, 2018 · 10 comments
Labels
craft3 Schematic 4+ for craft3 enhancement question

Comments

@timkelty
Copy link

timkelty commented Jun 4, 2018

Some plugins have settings thats cannot be translated to static values (e.g. closures), that are explicitly set in config files.

I recently ran into an issue with https://github.com/clubstudioltd/craft-asset-rev, where I exported (and later imported) but didn't notice that it imported the settings from my config/assetrev.php file.

In fact, that plugin has NO CP-set config options, so when they get entered in the DB via Schematic things get weird.

Furthermore, one value is a anonymous fn, which ended up importing as null, which broke things.

Any ideas on how to handle this, other than just excluding plugins?

@bvangennep
Copy link
Contributor

Maybe overriding the settings key of the plugin in the override file with null or an empty array will solve your issue?

@bvangennep bvangennep added question craft3 Schematic 4+ for craft3 labels Jun 4, 2018
@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

@bvangennep for use in importing or exporting?

I tried the following, and the plugin settings were still exported:

plugins:
  assetrev: { }
plugins:
  assetrev: null

@boboldehampsink
Copy link
Contributor

@timkelty did you use this in the override file with the latest schematic version?

@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

@boboldehampsink Yeah, 4.0.8

The above overrides file worked for import ( via craft schematic/import --override-file=config/overrides.yml), but had not affect on export.

Is that expected?

@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

Separate issue, but I think its a little confusing that export automatically picks up config/overrides.yml but import doesn't? (unless I'm missing something)

@boboldehampsink
Copy link
Contributor

boboldehampsink commented Jun 5, 2018

Well, since 4.0.8 the exported yaml is overridden with the override contents. And the override file is also automatically picked up in importing ;-) The argument flag is there if you want to use an other location or filename for the override file.

@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

Ok let me do some more testing and make sure I'm giving your the right info :)

@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

🤦‍♂️ ok all is working with override…I named my file overrides.yml 😁

So…back to the original issue - I'm wondering if Schematic should detect if a value is non-primitive (closure, etc) and throw an error when exporting?

@timkelty
Copy link
Author

timkelty commented Jun 5, 2018

FWIW, I tried this and it did not work:

My goal was to still export plugins.assetrev.isEnabled and plugins.assetrev.isInstalled but skip over plugins.assetrev.settings, though I suppose thats more of an excludes thing than an override.

plugins:
  assetrev:
    settings: {  }

@bvangennep
Copy link
Contributor

We'll look into it, for now you should be able to work around it with the override at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
craft3 Schematic 4+ for craft3 enhancement question
Projects
None yet
Development

No branches or pull requests

3 participants