Jump to:

4938 Posts in 16827 Topics by 1490 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » config.yml Cheat Sheet

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3369 Views
  • tazzydemon
    Avatar
    Community Member
    122 Posts

    config.yml Cheat Sheet Link to this post

    Guys

    I posted this on SSBits as well but I think the thread was a bit old.

    Its about time we had a /_config/config.yml plus _config.php combo cheatsheet.

    What you put in either when upgrading from a pure SS3 _config.php is quite confusing and the docs are awful!! I for one have a lot in my _config.php which set up the editor rather better. Plus I have a lot of potential shop config coming up.

    Some general conversion and syntax advice would be helpful

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: config.yml Cheat Sheet Link to this post

    What would make the documentation for the config system easier to follow?

    We avoided created a list of every. config. option as that is a huge infinite list of statics (same reason we can't produce a "list of all the template variables), it would be better to explain the features behind those statics (like Director::addRules) in context.

  • kinglozzer
    Avatar
    Community Member
    142 Posts

    Re: config.yml Cheat Sheet Link to this post

    tazzydemon: The most up-to-date docs are here, in case you were looking at an older version: http://doc.silverstripe.org/framework/en/trunk/topics/configuration#setting-configuration-via-yaml-files

    Willr: The docs are incredibly confusing. Read through the section imagining you are someone that has never used YAML - even if you do manage to understand all of what's said, there's no mention of YAML syntax and no way of telling which properties can be set with YAML. There isn't even an example of how to add an extension with YAML!

    Another example is that I've been trying to register dataobjects to the Google Sitemaps module, I have no idea how an array like that is supposed to be structured, or if you can even register dataobjects with YAML.

    tldr; the documentation needs more examples (doesn't need to be every config option, just a wide variety of possible use-cases), needs some form of advice about syntax and advice on which properties can be set in YAML (again not listing them all, just some rough guidance).

  • Fred C.
    Avatar
    Community Member
    18 Posts

    Re: config.yml Cheat Sheet Link to this post

    Here's an example. The thing that threw me is that I didn't realize that "extensions" must be in lower case, or it will not load the extension! The forum does not preserve indentation correctly, so the file is also attached.

    ---
    Name: mysite
    After:
    - 'framework/*'
    - 'cms/*'
    ---
    Member:
    extensions:
    - MemberExtension
    SiteTree:
    extensions:
    - MetadataExtension
    SiteConfig:
    extensions:
    - SiteConfigExtension
    SSViewer:
    theme: 'blueprint'

    Attached Files
  • tazzydemon
    Avatar
    Community Member
    122 Posts

    Re: config.yml Cheat Sheet Link to this post

    Question 1. Whats the hyphen for in this example? Its this type of syntax detail which is missing

    Question 2. In the following example I am trying to enable ImageMagick. Not that the _config.php version is without the function test statement

    YML:

    Image:
    backend: 'ImagickBackend'

    or _config.php:

    Image::set_backend('ImagickBackend');

    When to use the different type of config and what the arguments might be is as clear as mud.

  • tazzydemon
    Avatar
    Community Member
    122 Posts

    Re: config.yml Cheat Sheet Link to this post

    A look at http://en.wikipedia.org/wiki/YAML and its references cleared up a few things.

  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Re: config.yml Cheat Sheet Link to this post

    Willr - you asked about making the docs better. Some thoughts:

    The docs would be a lot better if the most common config settings were listed, to get people going. Also a list of common config settings that can't be set in the yaml files & why would be handy & would reduce the learning curve.

    eg, http://doc.silverstripe.org/framework/en/3.1/tutorials/4-site-search still shows to use the static method. why?

    I wouldn't think a description of how yaml works in the job of the SS docs, but a handy link would be friendly.

    read the source code is good general advice but its pretty hostile to new users.

    Silverstripe has a lot of documentation, but a common gripe is the documentation isn't very good. Thats a concern for sure. for an example of great docs, check out either the laravel or cakephp sites. They generally have a good general intro to a section & the concepts behind it, backed up with in depth specific sections with code examples for common uses with the context shown.

    finally, the silverstripe.org pages rarely load first time. It might be better if they were built with a static generator for some uptime & performance.

    in terms of handy links for this specific issue, i found this:

    http://www.silverstripe.org/assets/Uploads/config.yml.txt

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: config.yml Cheat Sheet Link to this post

    Interesting point, we're marking the config variables easier to spot in the code by using @config (like https://github.com/silverstripe/silverstripe-framework/blob/3.1/view/SSViewer.php#L596). I thought this pulled through to the API docs but obviously expecting too much

    Putting the relevant configuration values on the documentation pages is a good start (like SSViewer.theme on the templates page).

    3369 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.