Skip to content

Override couscous.yml configuration from command line #159

@cyberbit

Description

@cyberbit

This doesn't have to be super complex or super smart in my case, but with modifications it could be pretty powerful. More on that in a bit.

I have a project using Couscous that has three instances on three different servers. Documentation is generated out of a repository separate from the project. Because I use customized resources grabbed from the current server, I have to generate three different sets of documentation, changing the baseUrl on each one. I have them listed in couscous.yml, and just comment out the ones I don't need when generating.

Would it be possible to have a command-line syntax to override configuration variables at runtime? Perhaps something like this:

couscous generate --config:baseUrl=http://prod.server.com/ --config:title="Server.com PROD"

Or, to be more advanced (and insane), you could do the above changes and add a built-in configuration selector to shortcut to preset options. For example, in couscous.yml:

title:
    dev: Server.com DEV
    prod: Server.com PROD

description: A fantastic website

baseUrl:
    dev: https://dev.server.com
    prod: https://prod.server.com

At the command-line (--instance could be a more specific form of --config as well, perhaps equivalent to --config:_instance or something):

couscous generate --instance:dev

This would temporarily modify the configuration as if couscous.yml looked like this:

title: Server.com DEV
description: A fantastic website
baseUrl: https://dev.server.com

Admittedly, this is a pipe dream. There are limitations and implications that I recognize with this (selecting instance values in sub-options, restricted keywords, processing modified config file in an additional step, etc.). But even the first suggestion would reduce the amount of manual changes needed to publish correctly for my use case significantly, and feels like it would be easy to medium "hardness."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions