Configuration | ray-rust | Spatie      

 SPATIE  

ray-rust
========

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Ray-rust](https://spatie.be/docs/ray-rust/v1)  Configuration

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/ray-rust/v1) 

  Configuration    
- [ Introduction ](https://spatie.be/docs/ray-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/ray-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/ray-rust/v1/installation-and-setup)
- [ Using Ray with Rust ](https://spatie.be/docs/ray-rust/v1/usage)
- [ Configuration ](https://spatie.be/docs/ray-rust/v1/configuration)
- [ PHP compatibility ](https://spatie.be/docs/ray-rust/v1/compatibility)
- [ Testing ](https://spatie.be/docs/ray-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/ray-rust/v1/changelog)

 Configuration
=============

###  On this page 

1. [ Remote debugging ](#content-remote-debugging)
2. [ Reporting transport errors ](#content-reporting-transport-errors)

By default, Ray is listening on `localhost:23517`. You can configure another host and port using `Config`:

```
use spatie_ray::{Client, Config};

let client = Client::new(Config::default().host("localhost").port(23517));
client.ray().send("Hello world")?;
```

`Config::default()` uses these settings:

SettingDefault`host``localhost``port``23517``enabled``true``timeout`Two seconds`throws``false``project`Empty string`remote_path`No path mapping`always_send_raw_values``false`To load environment variables explicitly, use `Config::from_env()`:

```
let client = Client::new(Config::from_env()?);
ray!(client: client, "configured")?;
```

Supported variables are `RAY_HOST`, `RAY_PORT`, `RAY_ENABLED`, `RAY_PROJECT_NAME`, `RAY_REMOTE_PATH`, `RAY_LOCAL_PATH` and `RAY_ALWAYS_SEND_RAW_VALUES`. Booleans accept `true`, `false`, `1` or `0`. Invalid values return `Error::Config`. This does not load PHP configuration files.

The plain `ray!` macro uses a shared default client. Custom clients are explicit. Clones of one client share enablement, counters, timers, limits and project name; separately created clients are isolated. This replaces PHP's global mutable settings.

Remote debugging
--------------------------------------------------------------------------------------------------------

Map remote source paths to your local editor paths:

```
let client = Client::new(
    Config::default()
        .host("localhost")
        .remote_path("/var/www/my-project", "/Users/freek/my-project")
);
```

Only a matching prefix is replaced, in both origins and stack frames. Like PHP, the transport is unencrypted HTTP. Keep the port private and use an SSH tunnel for remote debugging. This client deliberately does not use HTTP proxies or follow redirects.

Reporting transport errors
--------------------------------------------------------------------------------------------------------------------------------------

When Ray is closed or unavailable, output is skipped without failing your application. Set `throws(true)` to return transport errors instead. JSON serialization, file reading, XML parsing and shared-state errors always propagate. Queries for `windows()` and `theme()` always report failures.

```
use std::time::Duration;

let client = Client::new(
    Config::default().throws(true).timeout(Duration::from_secs(2))
);
```

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
