Add env variable to define beacon server address
This commit replaces the default hardcoded value for the beacon server address with an envvar. This allows one to run comet on one machine while running the UI on another one (e.g. embedded system).
This commit is contained in:
parent
625fc76f19
commit
d58e9ef191
2 changed files with 18 additions and 5 deletions
|
|
@ -91,7 +91,7 @@ impl Event {
|
|||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
std::net::TcpListener::bind(client::SERVER_ADDRESS).is_err()
|
||||
std::net::TcpListener::bind(client::server_address_from_env()).is_err()
|
||||
}
|
||||
|
||||
pub fn run() -> impl Stream<Item = Event> {
|
||||
|
|
@ -99,7 +99,9 @@ pub fn run() -> impl Stream<Item = Event> {
|
|||
let mut buffer = Vec::new();
|
||||
|
||||
let server = loop {
|
||||
match net::TcpListener::bind(client::SERVER_ADDRESS).await {
|
||||
match net::TcpListener::bind(client::server_address_from_env())
|
||||
.await
|
||||
{
|
||||
Ok(server) => break server,
|
||||
Err(error) => {
|
||||
if error.kind() == io::ErrorKind::AddrInUse {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue