Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config should be persistent and updated via the HTTP api #11

Closed
benoitc opened this issue May 29, 2013 · 6 comments
Closed

Config should be persistent and updated via the HTTP api #11

benoitc opened this issue May 29, 2013 · 6 comments
Assignees
Milestone

Comments

@benoitc
Copy link
Member

benoitc commented May 29, 2013

in relation to #10

I'm thinking to add a config file in the release that would contain the main settings and containers descriptions.

@ghost ghost assigned benoitc May 29, 2013
@nrdufour
Copy link
Member

There is already a support for a configuration via application environment.
You can define storages in app.config. Look at https://github.com/refuge/coffer/blob/master/src/coffer_server.erl#L68.

Now perhaps this part could be refactored to have a full fledged config file like http port and other options.

@benoitc
Copy link
Member Author

benoitc commented May 29, 2013

@nrdufour this is already the case, you can define the conf and such but this isn't really human friendly imo. Also it can't be easily update via HTTP.

I suggest either to use INI or toml [1] as config formatI.

Example of config:

[core]
...

[storage "foo"]
backend = coffer_storage_ets
...

Ip, ports could still be configred in the app.config file. Note that if we can easily update the app.confi using HTTP I'm fine for it. Thought?

[1] https://github.com/mojombo/toml

@nrdufour
Copy link
Member

I like a lot toml one for sure.

It would be consistent to have just one config file for all.

@benoitc
Copy link
Member Author

benoitc commented May 29, 2013

+1 for the consistency.

@benoitc
Copy link
Member Author

benoitc commented Jun 19, 2013

We need to define which configuration will be persistent or not.

Items that I see persistent are:

  • addresses on which coffer is listening (+ ssl config for them)
  • storages configurations
  • replication configurations (if we need them persistent)

In yesterday discussion we discussed the possibility to have a database storing these configs informations. Maybe it isn't needed for a start. We could use econfig to manage the config in a configuration file. Eventually econfig can be updated to support toml. To make things easier we can also make the config system pluggable with a default to the config file.

Thoughts?

@nrdufour
Copy link
Member

I like the idea of starting simple with econfig.
The 3 items you mentioned are clearly the ones to go there.

So let's move on with econfig.

benoitc added a commit that referenced this issue Jun 23, 2013
initial step to handle the main configuration of coffer using an ini
file. For now add econfig tdependancy and handle the HTTP configuration.

Example of config file:

    [http main]
    listen = 7000

will listen all interfaces on the port 7000. Multiples HTTP interfaces
can be set.

listen is under the form [IP:]Port, where IP is an IP v4 or v6.

To setup an SSL connection add the following section:

    [http somessl]
    listen = 7001
    ssl = true
    cert_file = cert.pem
    cert_key = cert.key

Other ssl options are password, cacert_file. Check the elrang
documentation for more informations about these options. Multiple ssl
interfaces can be set.

Partially answer to #11 .
benoitc added a commit that referenced this issue Jun 29, 2013
If the http config changes, the new http handlers will get the new
config optins. If the protocol changes, the handler will automatically
be restarted (ie http -> https).

While I'm here refactor a little the code to make it reusable.

related to #11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants