Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Introduce a notion of 'environment' #40

Open
inklesspen opened this issue Aug 5, 2015 · 6 comments
Open

Introduce a notion of 'environment' #40

inklesspen opened this issue Aug 5, 2015 · 6 comments
Milestone

Comments

@inklesspen
Copy link
Owner

Bundle app config, server config, logging config into a single thing, loadable by name.

@inklesspen inklesspen modified the milestone: 0.3.0 Aug 5, 2015
@sontek
Copy link

sontek commented Aug 19, 2015

Yeah, I think something like this:

dev:
    application:
        foo: bar

    server:
        biz: baz

    logging:
        qix: quz

prod:
    ....

would work best because then when you load it up pyramid -c app.yaml -e dev serve

@inklesspen
Copy link
Owner Author

Unfortunately that is exactly inverted from how PasteDeploy does things, and since backwards compatibility is the only way Montague will get adoption, we're more likely to see something like this:

application:
    dev:
        foo: bar
    prod:
         foo: baz

Though of course your custom loader is free to rewrite one into the other.

@sontek
Copy link

sontek commented Aug 19, 2015

@inklesspen That doesn't work because the structure is:

{
    "globals": {},
    "application": {},
    "composite": {},
    "filter": {},
    "server": {},
    "logging": {},
}

and when you load an "environment" you want the server and logging configuration to change at the same time. You don't have the same logging or server in dev that you have in prod.

@inklesspen
Copy link
Owner Author

@sontek sure, but you'd have a 'dev' key under application, logging, and server that way. (or if you didn't have a 'dev' key, it would probably fall back to 'main')

As an example, Mimir has a toml config file (well, it has a Mako template that renders to toml) with this sort of setup. There's a development key in application, server, and logging; currently the bundled scripts require you specify the key you want for each of those three things, but there's no reason there couldn't be an 'env' command line option that uses the same key for each of the three.

@sontek
Copy link

sontek commented Aug 19, 2015

Yeah, I see what you are getting at. More verbose and less organized but it works

@inklesspen
Copy link
Owner Author

Well, we're programmers. We can rearrange things all we like. I was just super lazy and had the TOML format mirror the format required in the API. There's no reason you would also have to do that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants