Skip to content

Commit d55b144

Browse files
committed
Fix: listener should not be hardcoded.
1 parent b1b081f commit d55b144

File tree

2 files changed

+5
-4
lines changed
  • rust

2 files changed

+5
-4
lines changed

rust/crates/greenbone-scanner-framework/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ fn retrieve_and_reset_client_identifier(id: Arc<RwLock<ClientIdentifier>>) -> Cl
137137

138138
impl Default for RuntimeBuilder<runtime_builder_states::Start> {
139139
fn default() -> Self {
140-
Self::new()
140+
Self::new(([127, 0, 0, 1], 3000).into())
141141
}
142142
}
143143

144144
impl<T> RuntimeBuilder<T> {
145-
pub fn new() -> RuntimeBuilder<runtime_builder_states::Start> {
145+
pub fn new(listener_address: SocketAddr) -> RuntimeBuilder<runtime_builder_states::Start> {
146146
let mut handlers = RequestHandlers::default();
147147
//handlers.push(GetScansPreferencesHandler::default());
148148
// TODO: do per prefix?
@@ -156,7 +156,7 @@ impl<T> RuntimeBuilder<T> {
156156
tls: None,
157157
api_keys: None,
158158
handlers,
159-
listener_address: ([127, 0, 0, 1], 3000).into(),
159+
listener_address,
160160
_phantom: PhantomData,
161161
}
162162
}

rust/src/openvasd/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ async fn main() -> Result<()> {
8989
let vts = Arc::new(vts);
9090
let scan = scans::init(pool.clone(), &config, get_feed_state(vts.clone())).await?;
9191
let (get_notus, post_notus) = notus::init(products.clone());
92-
let mut rb = RuntimeBuilder::<greenbone_scanner_framework::End>::new()
92+
93+
let mut rb = RuntimeBuilder::<greenbone_scanner_framework::End>::new(config.listener.address)
9394
// TODO: use a lambda like in scanner instead.
9495
// That way we don't need to manage tokio::spawn_blocking all over the place
9596
.feed_version(feed_state2.clone());

0 commit comments

Comments
 (0)