# file

Grey Matter Fabric supports service discovery from a flat file. See the [Grey Matter Control file discovery setup documentation](https://greymatter.gitbook.io/grey-matter-documentation/1.7-beta/reference/setup/fabric-1/gm-control/gm-control-file) for how to configure this with Grey Matter Control.

## File Discovery and Format

File-based discovery watches a single file on disk for additions and deletions of service clusters and instances. This mechanism is more brute-force than the other options, but provides discovery on platforms that may not otherwise be supported.

The format defines clusters and the associated instances. The `cluster` key in each object determines which service this is, and the `instances` array gives the list of `host:port` pairs for each instance. The file format is described generically [here](https://greymatter.gitbook.io/grey-matter-documentation/1.7-beta/reference/setup/fabric-1/gm-control/gm-control-file#file-specifications) in the setup documentation, and an example for each possible format is [below](#file-examples).

### File Examples

```yaml
- cluster: service-a
  instances:
    - host: localhost
      port: 9080
    - host: 10.0.2.237
      port: 9080
- cluster: service-b
  instances:
    - host: 10.1.1.45
      port: 443
```

```javascript
[
  {
    "cluster": "service-a",
    "instances": [
      {
        "host": "localhost",
        "port": 9080
      },
      {
        "host": "10.0.2.237",
        "port": 9080
      }
    ]
  },
  {
    "cluster": "service-b",
    "instances": [
      {
        "host": "10.1.1.45",
        "port": 443
      }
    ]
  }
]
```
