update readme and config creating if does not exists

This commit is contained in:
MeexReay 2024-09-14 01:17:40 +03:00
parent 338991b9c1
commit c30cf3fbe9
3 changed files with 23 additions and 14 deletions

View File

@ -11,20 +11,23 @@ Features:
Default `conf.yml`: Default `conf.yml`:
```yml ```yml
http_host: localhost:80 http_host: localhost:80 # Http server host
https_host: localhost:443 https_host: localhost:443 # Https server host
sites: sites:
# - domain: example.com # Domain with SSL # - domain: example.com # Domain with SSL
# host: localhost:8080 # host: localhost:8080 # Http server host
# ssl_cert: "/path/to/public/certificate.txt" # ssl_cert: "/path/to/public/certificate.txt" # Ssl public certificate file
# ssl_key: "/path/to/private/key.txt" # ssl_key: "/path/to/private/key.txt" # Ssl private key file
# support_keep_alive: true # Does server supports keep-alive connections
# - domain: sub.example.com # Domain with no SSL # - domain: sub.example.com # Domain with no SSL
# host: localhost:8081 # host: localhost:8081 # Http server host
# support_keep_alive: true # Does server supports keep-alive connections
- domain: localhost - domain: localhost
host: localhost:8080 host: localhost:8080
support_keep_alive: false
``` ```
Rust features: Rust features:

View File

@ -1,16 +1,16 @@
http_host: localhost:80 http_host: localhost:80 # Http server host
https_host: localhost:443 https_host: localhost:443 # Https server host
sites: sites:
# - domain: example.com # Domain with SSL # - domain: example.com # Domain with SSL
# host: localhost:8080 # host: localhost:8080 # Http server host
# ssl_cert: "/path/to/public/certificate.txt" # ssl_cert: "/path/to/public/certificate.txt" # Ssl public certificate file
# ssl_key: "/path/to/private/key.txt" # ssl_key: "/path/to/private/key.txt" # Ssl private key file
# support_keep_alive: true # support_keep_alive: true # Does server supports keep-alive connections
# - domain: sub.example.com # Domain with no SSL # - domain: sub.example.com # Domain with no SSL
# host: localhost:8081 # host: localhost:8081 # Http server host
# support_keep_alive: true # support_keep_alive: true # Does server supports keep-alive connections
- domain: localhost - domain: localhost
host: localhost:8080 host: localhost:8080

View File

@ -1,8 +1,14 @@
use std::{fs, path::Path};
use flowgate::{Config, FlowgateServer}; use flowgate::{Config, FlowgateServer};
fn main() { fn main() {
colog::init(); colog::init();
if !Path::new("conf.yml").exists() {
let _ = fs::write("conf.yml", include_bytes!("../conf.yml"));
}
let config = Config::parse("conf.yml").unwrap(); let config = Config::parse("conf.yml").unwrap();
let server = FlowgateServer::new(config); let server = FlowgateServer::new(config);