Use port 8000 as default for all environments.

Closes #317.
This commit is contained in:
Donald Robertson 2017-10-05 20:59:06 +01:00 committed by Sergio Benitez
parent b0c1a0a07f
commit 19f59b1f9b
6 changed files with 15 additions and 17 deletions

View File

@ -16,7 +16,7 @@ is_extra = true # this is an unused extra; maybe application specific?
[staging] [staging]
address = "0.0.0.0" address = "0.0.0.0"
port = 80 port = 8000
log = "normal" log = "normal"
workers = 8 workers = 8
# don't use this key! generate your own and keep it private! # don't use this key! generate your own and keep it private!
@ -24,7 +24,7 @@ secret_key = "8Xui8SN4mI+7egV/9dlfYYLGQJeEx4+DwmSQLwDVXJg="
[production] [production]
address = "0.0.0.0" address = "0.0.0.0"
port = 80 port = 8000
workers = 12 workers = 12
log = "critical" log = "critical"
# don't use this key! generate your own and keep it private! # don't use this key! generate your own and keep it private!

View File

@ -27,7 +27,7 @@ fn check_config(config: State<LocalConfig>) -> Option<()> {
} }
"staging" => { "staging" => {
assert_eq!(config.address, "0.0.0.0".to_string()); assert_eq!(config.address, "0.0.0.0".to_string());
assert_eq!(config.port, 80); assert_eq!(config.port, 8000);
assert_eq!(config.workers, 8); assert_eq!(config.workers, 8);
assert_eq!(config.log_level, LoggingLevel::Normal); assert_eq!(config.log_level, LoggingLevel::Normal);
assert_eq!(config.environment, config::Environment::Staging); assert_eq!(config.environment, config::Environment::Staging);
@ -35,7 +35,7 @@ fn check_config(config: State<LocalConfig>) -> Option<()> {
} }
"production" => { "production" => {
assert_eq!(config.address, "0.0.0.0".to_string()); assert_eq!(config.address, "0.0.0.0".to_string());
assert_eq!(config.port, 80); assert_eq!(config.port, 8000);
assert_eq!(config.workers, 12); assert_eq!(config.workers, 12);
assert_eq!(config.log_level, LoggingLevel::Critical); assert_eq!(config.log_level, LoggingLevel::Critical);
assert_eq!(config.environment, config::Environment::Production); assert_eq!(config.environment, config::Environment::Production);

View File

@ -1,3 +1,2 @@
[global] [global]
port = 8000 port = 8000

View File

@ -225,7 +225,7 @@ impl Config {
Config { Config {
environment: Staging, environment: Staging,
address: "0.0.0.0".to_string(), address: "0.0.0.0".to_string(),
port: 80, port: 8000,
workers: default_workers, workers: default_workers,
log_level: LoggingLevel::Normal, log_level: LoggingLevel::Normal,
secret_key: key, secret_key: key,
@ -239,7 +239,7 @@ impl Config {
Config { Config {
environment: Production, environment: Production,
address: "0.0.0.0".to_string(), address: "0.0.0.0".to_string(),
port: 80, port: 8000,
workers: default_workers, workers: default_workers,
log_level: LoggingLevel::Critical, log_level: LoggingLevel::Critical,
secret_key: key, secret_key: key,

View File

@ -78,7 +78,7 @@
//! //!
//! [staging] //! [staging]
//! address = "0.0.0.0" //! address = "0.0.0.0"
//! port = 80 //! port = 8000
//! workers = [number_of_cpus * 2] //! workers = [number_of_cpus * 2]
//! log = "normal" //! log = "normal"
//! secret_key = [randomly generated at launch] //! secret_key = [randomly generated at launch]
@ -86,7 +86,7 @@
//! //!
//! [production] //! [production]
//! address = "0.0.0.0" //! address = "0.0.0.0"
//! port = 80 //! port = 8000
//! workers = [number_of_cpus * 2] //! workers = [number_of_cpus * 2]
//! log = "critical" //! log = "critical"
//! secret_key = [randomly generated at launch] //! secret_key = [randomly generated at launch]

View File

@ -23,17 +23,16 @@ example, to launch an application in the `staging` environment, we can run:
ROCKET_ENV=stage cargo run ROCKET_ENV=stage cargo run
``` ```
You'll likely need `sudo` for the command to succeed since `staging` defaults to Note that you can use the short or long form of the environment name to specify
listening on port `80`. Note that you can use the short or long form of the the environment, `stage` _or_ `staging` here. Rocket tells us the environment we
environment name to specify the environment, `stage` _or_ `staging` here. Rocket have chosen and its configuration when it launches:
tells us the environment we have chosen and its configuration when it launches:
```sh ```sh
$ sudo ROCKET_ENV=staging cargo run $ sudo ROCKET_ENV=staging cargo run
🔧 Configured for staging. 🔧 Configured for staging.
=> address: 0.0.0.0 => address: 0.0.0.0
=> port: 80 => port: 8000
=> log: normal => log: normal
=> workers: [logical cores * 2] => workers: [logical cores * 2]
=> secret key: generated => secret key: generated
@ -41,7 +40,7 @@ $ sudo ROCKET_ENV=staging cargo run
=> tls: disabled => tls: disabled
🛰 Mounting '/': 🛰 Mounting '/':
=> GET / => GET /
🚀 Rocket has launched from http://0.0.0.0:80 🚀 Rocket has launched from http://0.0.0.0:8000
``` ```
## Rocket.toml ## Rocket.toml
@ -70,7 +69,7 @@ limits = { forms = 32768 }
[staging] [staging]
address = "0.0.0.0" address = "0.0.0.0"
port = 80 port = 8000
workers = [number of cpus * 2] workers = [number of cpus * 2]
log = "normal" log = "normal"
secret_key = [randomly generated at launch] secret_key = [randomly generated at launch]
@ -78,7 +77,7 @@ limits = { forms = 32768 }
[production] [production]
address = "0.0.0.0" address = "0.0.0.0"
port = 80 port = 8000
workers = [number of cpus * 2] workers = [number of cpus * 2]
log = "critical" log = "critical"
secret_key = [randomly generated at launch] secret_key = [randomly generated at launch]