mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: add an option to disable startup message (#17645)
This commit is contained in:
parent
2c349247e1
commit
8c35ee0722
@ -390,9 +390,10 @@ pub fn run[T](global_app &T, port int) {
|
|||||||
|
|
||||||
[params]
|
[params]
|
||||||
pub struct RunParams {
|
pub struct RunParams {
|
||||||
host string
|
host string
|
||||||
port int = 8080
|
port int = 8080
|
||||||
family net.AddrFamily = .ip6 // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1
|
family net.AddrFamily = .ip6 // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1
|
||||||
|
show_startup_message bool = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// run_at - start a new VWeb server, listening only on a specific address `host`, at the specified `port`
|
// run_at - start a new VWeb server, listening only on a specific address `host`, at the specified `port`
|
||||||
@ -420,7 +421,9 @@ pub fn run_at[T](global_app &T, params RunParams) ! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
host := if params.host == '' { 'localhost' } else { params.host }
|
host := if params.host == '' { 'localhost' } else { params.host }
|
||||||
println('[Vweb] Running app on http://${host}:${params.port}/')
|
if params.show_startup_message {
|
||||||
|
println('[Vweb] Running app on http://${host}:${params.port}/')
|
||||||
|
}
|
||||||
flush_stdout()
|
flush_stdout()
|
||||||
for {
|
for {
|
||||||
// Create a new app object for each connection, copy global data like db connections
|
// Create a new app object for each connection, copy global data like db connections
|
||||||
|
Loading…
Reference in New Issue
Block a user