mirror of https://github.com/apibillme/broker
remove cors flag
This commit is contained in:
parent
ab14e39731
commit
6606113124
|
@ -99,7 +99,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "broker"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
dependencies = [
|
||||
"bcrypt 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "broker"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
|
|
@ -162,21 +162,19 @@ pub async fn main() {
|
|||
broker().await
|
||||
}
|
||||
```
|
||||
- the origin (CORS) needs to be passed in as a flag with wildcard not supported
|
||||
- the port needs to be passed in as a flag
|
||||
- the expiry (for jwts) needs to be passed in as a flag
|
||||
- the secret (for jwts) needs to be passed in as a flag
|
||||
- the save_path where the embedded database will save needs to be passed in as an environment variable (not for snap)
|
||||
- the save_path where the embedded database will save needs to be passed in as an environment variable
|
||||
- example: SAVE_PATH=./tmp/broker_data broker -port 8080 -origin http://localhost:3000 -expiry 3600 -secret secret
|
||||
|
||||
### Install Crate
|
||||
|
||||
``` cargo install broker ```
|
||||
- the origin (CORS) needs to be passed in as a flag with wildcard not supported
|
||||
- the port needs to be passed in as a flag
|
||||
- the expiry (for jwts) needs to be passed in as a flag
|
||||
- the secret (for jwts) needs to be passed in as a flag
|
||||
- the save_path where the embedded database will save needs to be passed in as an environment variable (not for snap)
|
||||
- the save_path where the embedded database will save needs to be passed in as an environment variable
|
||||
- example: SAVE_PATH=./tmp/broker_data broker -port 8080 -origin http://localhost:3000 -expiry 3600 -secret secret
|
||||
|
||||
## Install Linux Snap
|
||||
|
@ -184,7 +182,6 @@ pub async fn main() {
|
|||
``` sudo snap install broker ```
|
||||
- does not run as a daemon as requires flags
|
||||
- the snap saves the database in [$SNAP_DATA/broker_data](https://snapcraft.io/docs/environment-variables) - which is /var/snap/broker/{rev#}/broker_data - where rev# is the revision number
|
||||
- the origin (CORS) needs to be passed in as a flag with wildcard not supported
|
||||
- the port needs to be passed in as a flag
|
||||
- the expiry (for jwts) needs to be passed in as a flag
|
||||
- the secret (for jwts) needs to be passed in as a flag
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: broker # you probably want to 'snapcraft register <name>'
|
||||
base: core18 # the base snap is the execution environment for this snap
|
||||
version: '2.0.2' # just for humans, typically '1.2+git' or '1.3.2'
|
||||
version: '2.0.3' # just for humans, typically '1.2+git' or '1.3.2'
|
||||
summary: Real-time Zero-Code API Server # 79 char long summary
|
||||
description: |
|
||||
The purpose of this library is to be your real-time zero-code API server.
|
||||
|
|
|
@ -66,7 +66,6 @@ pub struct SSE {
|
|||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub port: String,
|
||||
pub origin: String,
|
||||
pub expiry: i64,
|
||||
pub secret: String,
|
||||
pub save_path: String,
|
||||
|
@ -320,12 +319,10 @@ fn config() -> Config {
|
|||
|
||||
let mut port = "8080".to_owned();
|
||||
let mut expiry : i64 = 3600;
|
||||
let mut origin = "http://localhost:3000".to_owned();
|
||||
let mut secret = "secret".to_owned();
|
||||
let _ : Vec<String> = go_flag::parse(|flags| {
|
||||
flags.add_flag("port", &mut port);
|
||||
flags.add_flag("expiry", &mut expiry);
|
||||
flags.add_flag("origin", &mut origin);
|
||||
flags.add_flag("secret", &mut secret);
|
||||
});
|
||||
|
||||
|
@ -334,7 +331,7 @@ fn config() -> Config {
|
|||
Err(_) => "./tmp/broker_data".to_owned()
|
||||
};
|
||||
|
||||
Config{port: port, origin: origin, secret: secret, save_path: save_path, expiry: expiry}
|
||||
Config{port: port, secret: secret, save_path: save_path, expiry: expiry}
|
||||
}
|
||||
|
||||
fn jwt_verify(config: Config, token: String) -> JWT {
|
||||
|
|
Loading…
Reference in New Issue