Setting Overhaul #127
Replies: 5 comments 1 reply
-
hi, I just want to add a useful link https://12factor.net/ "The twelve-factor app is a methodology for building software-as-a-service apps". I think that's a good collection of "good practices" for operations. It has a specific section for configuration: https://12factor.net/config And also for logs, which it's something we have also discussed in the past: https://12factor.net/logs And another one for Dev/prod parity: https://12factor.net/dev-prod-parity In my PR for docker support, I'm trying to use the same image for development and production. Or at least, you can use ARGs to modify it. I think ideally everyone should be able to use the official image without needing to build a new one. |
Beta Was this translation helpful? Give feedback.
-
Solution 1: generate config data from
|
Beta Was this translation helpful? Give feedback.
-
Proposal: Simplify configurationhi @da2ce7 @WarmBeer, I've been thinking about the configuration file. I think regardless of the final format we decide to use (.env, json, yaml, toml, XML, ...), we should try to make it as much simple as possible. There are a couple of things that make the configuration more complex:
If we keep a simple data structure (a list of pair key-value), we could generate any format (json, toml, XML...), even the simplest one, On the other hand, do we need to launch more than one UDP or HTTP tracker @WarmBeer? Why do not you launch a new app instance? Why would you need more than one port? Is there any reason for that? |
Beta Was this translation helpful? Give feedback.
-
Torrust currently uses the config-rs crate for the management a configuration file. The configuration code is centralized within the config.rs file, and loaded from the main.rs file. Previously I worked on a pull request to #105 that tried to rework the entire configuration concept, it used rust's built-in json serialization and deserialization, it auto generated the configuration and supported upgrading from the old configuration. However when writing this pull request, I instead got lost in a side-project, fixing the clippy warning for torrust: #110 #115 , and since then there has been significant changes that makes the re-base difficult. One of the key features in my design was to make all the configuration options optional, and sharing configuration properties where possible. When working on the docker support for torrust, @josecelano opened this detailed discussion on the various possibilities for configuration. I have also considered these options, and since have found a interesting crate called Figment, that has many interesting properties. |
Beta Was this translation helpful? Give feedback.
-
Many changes were implemented in this issue: #401 |
Beta Was this translation helpful? Give feedback.
-
@da2ce7 is working on a setting Overhaul.
@josecelano has proposed moving the initial setting setup to its binary. The reason behind that is that the configuration file makes things harder when using docker to run the application. @josecelano has been working on a PR to add docker support.
@Power2All has also dockerized the application on a fork. That solution uses a shell script to generate the
config.toml
file before running the application. It takes the values from env vars. This solution does not need any change in the source code.I've created this discussion to collect all the information about settings.
@da2ce7 @josecelano and @WarmBeer were discussing a solution today. It seems we need a more friendly solution to handle the configuration.
Requirements
Notes
config.toml
file is not a plan list of env vars. It has groups and it also has arrays. Notice that you can have more than one UDP tracker and HTTP tracker, and you need a group of configuration values for each.Proposed solutions
We can reply with the proposed solution. Just give it a name so we can easily refer to it.
Links
cc @WarmBeer @cgbosse
Beta Was this translation helpful? Give feedback.
All reactions