mirror of https://github.com/rwf2/Rocket.git
parent
b0c1a0a07f
commit
19f59b1f9b
|
@ -16,7 +16,7 @@ is_extra = true # this is an unused extra; maybe application specific?
|
|||
|
||||
[staging]
|
||||
address = "0.0.0.0"
|
||||
port = 80
|
||||
port = 8000
|
||||
log = "normal"
|
||||
workers = 8
|
||||
# don't use this key! generate your own and keep it private!
|
||||
|
@ -24,7 +24,7 @@ secret_key = "8Xui8SN4mI+7egV/9dlfYYLGQJeEx4+DwmSQLwDVXJg="
|
|||
|
||||
[production]
|
||||
address = "0.0.0.0"
|
||||
port = 80
|
||||
port = 8000
|
||||
workers = 12
|
||||
log = "critical"
|
||||
# don't use this key! generate your own and keep it private!
|
||||
|
|
|
@ -27,7 +27,7 @@ fn check_config(config: State<LocalConfig>) -> Option<()> {
|
|||
}
|
||||
"staging" => {
|
||||
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.log_level, LoggingLevel::Normal);
|
||||
assert_eq!(config.environment, config::Environment::Staging);
|
||||
|
@ -35,7 +35,7 @@ fn check_config(config: State<LocalConfig>) -> Option<()> {
|
|||
}
|
||||
"production" => {
|
||||
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.log_level, LoggingLevel::Critical);
|
||||
assert_eq!(config.environment, config::Environment::Production);
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
[global]
|
||||
port = 8000
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ impl Config {
|
|||
Config {
|
||||
environment: Staging,
|
||||
address: "0.0.0.0".to_string(),
|
||||
port: 80,
|
||||
port: 8000,
|
||||
workers: default_workers,
|
||||
log_level: LoggingLevel::Normal,
|
||||
secret_key: key,
|
||||
|
@ -239,7 +239,7 @@ impl Config {
|
|||
Config {
|
||||
environment: Production,
|
||||
address: "0.0.0.0".to_string(),
|
||||
port: 80,
|
||||
port: 8000,
|
||||
workers: default_workers,
|
||||
log_level: LoggingLevel::Critical,
|
||||
secret_key: key,
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
//!
|
||||
//! [staging]
|
||||
//! address = "0.0.0.0"
|
||||
//! port = 80
|
||||
//! port = 8000
|
||||
//! workers = [number_of_cpus * 2]
|
||||
//! log = "normal"
|
||||
//! secret_key = [randomly generated at launch]
|
||||
|
@ -86,7 +86,7 @@
|
|||
//!
|
||||
//! [production]
|
||||
//! address = "0.0.0.0"
|
||||
//! port = 80
|
||||
//! port = 8000
|
||||
//! workers = [number_of_cpus * 2]
|
||||
//! log = "critical"
|
||||
//! secret_key = [randomly generated at launch]
|
||||
|
|
|
@ -23,17 +23,16 @@ example, to launch an application in the `staging` environment, we can run:
|
|||
ROCKET_ENV=stage cargo run
|
||||
```
|
||||
|
||||
You'll likely need `sudo` for the command to succeed since `staging` defaults to
|
||||
listening on port `80`. Note that you can use the short or long form of the
|
||||
environment name to specify the environment, `stage` _or_ `staging` here. Rocket
|
||||
tells us the environment we have chosen and its configuration when it launches:
|
||||
Note that you can use the short or long form of the environment name to specify
|
||||
the environment, `stage` _or_ `staging` here. Rocket tells us the environment we
|
||||
have chosen and its configuration when it launches:
|
||||
|
||||
```sh
|
||||
$ sudo ROCKET_ENV=staging cargo run
|
||||
|
||||
🔧 Configured for staging.
|
||||
=> address: 0.0.0.0
|
||||
=> port: 80
|
||||
=> port: 8000
|
||||
=> log: normal
|
||||
=> workers: [logical cores * 2]
|
||||
=> secret key: generated
|
||||
|
@ -41,7 +40,7 @@ $ sudo ROCKET_ENV=staging cargo run
|
|||
=> tls: disabled
|
||||
🛰 Mounting '/':
|
||||
=> GET /
|
||||
🚀 Rocket has launched from http://0.0.0.0:80
|
||||
🚀 Rocket has launched from http://0.0.0.0:8000
|
||||
```
|
||||
|
||||
## Rocket.toml
|
||||
|
@ -70,7 +69,7 @@ limits = { forms = 32768 }
|
|||
|
||||
[staging]
|
||||
address = "0.0.0.0"
|
||||
port = 80
|
||||
port = 8000
|
||||
workers = [number of cpus * 2]
|
||||
log = "normal"
|
||||
secret_key = [randomly generated at launch]
|
||||
|
@ -78,7 +77,7 @@ limits = { forms = 32768 }
|
|||
|
||||
[production]
|
||||
address = "0.0.0.0"
|
||||
port = 80
|
||||
port = 8000
|
||||
workers = [number of cpus * 2]
|
||||
log = "critical"
|
||||
secret_key = [randomly generated at launch]
|
||||
|
|
Loading…
Reference in New Issue