Environment Configuration unclear documentation


Sorry, i am a beginner with Grav, and I am struggling to understand the environment-config (Environment Configuration | Grav Documentation) manual. For example:
" Up to Grav 1.6 environments were stored in user/ folder. Grav 1.7 moves environments to user/env/ to make environments easier to maintain. It is highly recommended that you move all the environments into this new location on your existing sites. "

I have the latest version of Grav installed (1.7.3), but there is no user/env folder? There is also no explanation how to get it or how to get Grav to use it? Do I need to read another section of the Grav-documentation to understand this?


@rkvdmeer, You create the folders and create/move the config files into the right location yourself manually.

Once Grav (or Admin) finds an existing config file in a location matching the domain, it will be picked up and its content will override the default setting.

Unfortunately, Admin will write all data belonging to a config file to file, instead of only the deltas.

Thanks for the reply!
I tried that earlier but it does not work, so maybe I do something wrong. Initially I have a user-folder with the folders accounts, config, data, pages and themes in it.
Now I create a new ‘env’-folder in the ‘user’-folder. In that ‘env’-folder I create a folder for each environment, for example a ‘test’-folder and to that folder I move the folders accounts, config, data, pages and themes that were initially in the user-folder?
If I do that and try to open the site (localhost/test) I get the message that grav misses these folders in the user-folder.

@rkvdmeer, It’s about configuration files

These are files which are stored below /user/config:

  • user/config/*.yaml
  • user/config/themes/*.yaml
  • user/config/plugins/*.yaml

These files can be overridden for specific environments: localhost, mysite.com:

  • user/env/localhost/config/*.yaml
  • user/env/localhost/config/plugins/*.yaml
  • user/env/localhost/config/themes/*.yaml
  • user/env/mysite.com/config/*.yaml
  • etc.

Sorry, i am a beginner with Grav […] Do I need to read another section of the Grav-documentation to understand this?

As a beginner it might be an idea to start with the intro chapters first before moving to Advanced… :wink:

Thanks. I got it working now but only with the setup.php from the Multisite Setup manual. If I do not use that setup.php file it still does not work. If you have parts of the manual I should read again to understand the environment configuration, please let me know.

In your answer you said:

  • user/config/*.yaml
  • user/config/themes/*.yaml
  • user/config/plugins/*.yaml
    but i have now
  • user/config/*.yaml
  • user/themes/…/*yaml
  • user/plugins/…/*yaml
  • user/data/*.yaml
  • user/pages. - can be empty
    and that works :+1:

I actually read all the chapters :slight_smile: Might have missed the part that you need to have these directories in the user-folder too… Would be handy if this was mentioned in the line in my first post.

Tnanks again!

@rkvdmeer, Back to square one…

Well, I have one domain for my business with business-specific information. Within that domain I would like to have sections (subfolders with different themes) to promote different products. So

I thought it would be better to have 1 Grav-setup for these different sites, just to save space and maintenance. But maybe there is a better way to implement this.

Besides that I thought it would be handy to have a split development and production-environment. I am going to use github and they mention this at the end of this article (Picking a Development Strategy | Grav CMS). It is not that important though.

@rkvdmeer, Ah, that’s quite a bit of info that would have been valuable in the initial post… :wink:

Anyway, I have no experience with Multi-Site setup and considering the warnings in the docs, it would not be my first choice if all I wanted is sections in my site with different look-and-feel.

I guess there is a large commonality between the product sections, to keep the main business style recognisable. Maybe different stylesheets may suffice, or else including different Twig partials.

I think I would first look at the option of a single theme which changes look-and-feel by using a switch in Twig and based on the switch load different css assets and maybe include different Twig partials.

Possible switches:

  • In Twig, check the path of the page
  • Or add a frontmatter variable indicating the product section.
  • Or use different templates for the pages in different product sections.

Thanks so much for the tips! I will give it a try