Skip to content

Commit

Permalink
vweb: add an option to disable startup message (#17645)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZhou authored Mar 17, 2023
1 parent 2c34924 commit 8c35ee0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vlib/vweb/vweb.v
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,10 @@ pub fn run[T](global_app &T, port int) {

[params]
pub struct RunParams {
host string
port int = 8080
family net.AddrFamily = .ip6 // use `family: .ip, host: 'localhost'` when you want it to bind only to 127.0.0.1
host string
port int = 8080
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`
Expand Down Expand Up @@ -420,7 +421,9 @@ pub fn run_at[T](global_app &T, params RunParams) ! {
}
}
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()
for {
// Create a new app object for each connection, copy global data like db connections
Expand Down

0 comments on commit 8c35ee0

Please sign in to comment.