Skip to content

Allow values in superstatic.json to be overridden from command line option  #102

@greghuc

Description

@greghuc

As requested by @scottcorgan, I'm creating an issue that fell out of #90.

The suggestion is to make superstatic server config a merged combination of values in the divshot.json file, overridden by any config values specified on the command line.

In the context of divshot.io hosting, this should enable config overrides to be made when developing locally, overriding the deployed-server configuration specified in divshot.json.

My particular use case is that I want cache_control values in divshot.json, but want to disable it for local development.

So for local dev, I could say

superstatic -config-override '{ "cache_control": { "/**": false } }' -config divshot.json

And divshot.json would contain:

{
    "cache_control": {
        "/**": 3600
    }
}

And you could remove the --no-cache option that I'm not convinced is working :-): https://github.com/divshot/divshot-cli/issues/101

I believe @@dminkovsky has another use case for this.

The last time I did JSON merging/overriding, I used the jq CLI tool. Might be worth looking at for ideas.

Oh, and logging would definitely be beneficial to see the final merged server config!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions