From 1c0f2d41a705ea38fe7f7994b129461d4a4a6195 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Sat, 6 Oct 2018 17:09:10 +1300 Subject: [PATCH] Explain 'rocket::custom()' in configuration guide. Resolves #371. --- site/guide/configuration.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/site/guide/configuration.md b/site/guide/configuration.md index a2393d8c..73c07a2b 100644 --- a/site/guide/configuration.md +++ b/site/guide/configuration.md @@ -237,6 +237,23 @@ ROCKET_ARRAY=[1,"b",3.14] ROCKET_DICT={key="abc",val=123} ``` +## rocket::custom + +Rocket can also be configured using `rocket::custom` and passing configuration options like so: + +```rust +use rocket::config::{Config, Environment}; + +let config = Config::build(Environment::Staging) + .address("1.2.3.4") + .port(9234) + .finalize()?; + +let app = rocket::custom(config, false); +``` + +If Rocket is launched through `rocket::custom` it will ignore `Rocket.toml` and any environment variables present, allowing you to use your own configuration loading code. + ## Configuring TLS Rocket includes built-in, native support for TLS >= 1.2 (Transport Layer