Skip to content

Configuration overhaul: define default values and remove default values from config file templates #603

@josecelano

Description

@josecelano

Parent issue: #586

We should allow the users to override only config options when they don't want to use default values.

Current default config in toml format

[website]
name = "Torrust"

[tracker]
url = "udp://localhost:6969"
mode = "Public"
api_url = "http://localhost:1212/"
token = "MyAccessToken"
token_valid_seconds = 7257600

[net]
port = 3001

[auth]
email_on_signup = "Optional"
min_password_length = 6
max_password_length = 64
secret_key = "MaxVerstappenWC2021"

[database]
connect_url = "sqlite://data.db?mode=rwc"

[mail]
email_verification_enabled = false
from = "[email protected]"
reply_to = "[email protected]"
username = ""
password = ""
server = ""
port = 25

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
torrent_info_update_interval = 3600
port = 3002

Current default config in type debug ouput

Settings {
    log_level: None,
    website: Website {
        name: "Torrust",
    },
    tracker: Tracker {
        url: Url {
            scheme: "udp",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: Some(
                Domain(
                    "localhost",
                ),
            ),
            port: Some(
                6969,
            ),
            path: "",
            query: None,
            fragment: None,
        },
        mode: Public,
        api_url: Url {
            scheme: "http",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: Some(
                Domain(
                    "localhost",
                ),
            ),
            port: Some(
                1212,
            ),
            path: "/",
            query: None,
            fragment: None,
        },
        token: ApiToken(
            "MyAccessToken",
        ),
        token_valid_seconds: 7257600,
    },
    net: Network {
        port: 3001,
        base_url: None,
        tsl: None,
    },
    auth: Auth {
        email_on_signup: Optional,
        min_password_length: 6,
        max_password_length: 64,
        secret_key: SecretKey(
            "MaxVerstappenWC2021",
        ),
    },
    database: Database {
        connect_url: Url {
            scheme: "sqlite",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: Some(
                Domain(
                    "data.db",
                ),
            ),
            port: None,
            path: "",
            query: Some(
                "mode=rwc",
            ),
            fragment: None,
        },
    },
    mail: Mail {
        email_verification_enabled: false,
        from: Mailbox {
            name: None,
            email: Address {
                serialized: "[email protected]",
                at_start: 7,
            },
        },
        reply_to: Mailbox {
            name: None,
            email: Address {
                serialized: "[email protected]",
                at_start: 7,
            },
        },
        username: "",
        password: "",
        server: "",
        port: 25,
    },
    image_cache: ImageCache {
        max_request_timeout_ms: 1000,
        capacity: 128000000,
        entry_size_limit: 4000000,
        user_quota_period_seconds: 3600,
        user_quota_bytes: 64000000,
    },
    api: Api {
        default_torrent_page_size: 10,
        max_torrent_page_size: 30,
    },
    tracker_statistics_importer: TrackerStatisticsImporter {
        torrent_info_update_interval: 3600,
        port: 3002,
    },
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions