Skip to content

Commit

Permalink
feat(api): add option to filter storage devices by name
Browse files Browse the repository at this point in the history
fixes #314
  • Loading branch information
MauriceNino committed Sep 17, 2022
1 parent 7a5cc04 commit 5eb6efb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const CONFIG: Config = {
running_in_docker: penv('RUNNING_IN_DOCKER') === 'true',
accept_ookla_eula: penv('ACCEPT_OOKLA_EULA') === 'true',
use_network_interface: penv('USE_NETWORK_INTERFACE') ?? '',
fs_device_filter: lst(penv('FS_DEVICE_FILTER') ?? ''),
fs_type_filter: lst(
penv('FS_TYPE_FILTER') ?? 'cifs,9p,fuse.rclone,fuse.mergerfs,nfs4'
),
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/static-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export const mapToStorageLayout = (
) => {
const raidMembers = blocks.filter(block => block.fsType.endsWith('_member'));
const blockDisks = blocks.filter(
block => block.type === 'disk' && block.size > 0
block =>
block.type === 'disk' &&
block.size > 0 &&
!CONFIG.fs_device_filter.includes(block.name)
);

const blockLayout = blockDisks
Expand Down
31 changes: 31 additions & 0 deletions apps/docs/docs/config/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,37 @@ If dash. detects the wrong gateway as your default interface, you can provide a
- type: `string`
- default: `unset`

### `DASHDOT_FS_DEVICE_FILTER`

To hide specific drives, you can pass the device names as a string list using this parameter.
If you don't know the device names of your drives, have a look at the log of dash. and look for the `Static Server Info -> storage` output.

```js
storage: {
layout: [
{
// highlight-next-line
device: 'nvme0n1',
brand: 'Samsung',
size: 500107862016,
type: 'NVMe',
raidGroup: '',
},
{
// highlight-next-line
device: 'sda',
brand: 'DELL',
size: 4000225165312,
type: 'HD',
raidGroup: '',
},
];
}
```

- type: `string (comma separated list)`
- default: `unset`

### `DASHDOT_FS_TYPE_FILTER`

If dash. detects network drives as internal drives, you can provide a list of ignored FS types here.
Expand Down
1 change: 1 addition & 0 deletions libs/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type Config = {
running_in_docker: boolean;
use_network_interface: string;
accept_ookla_eula: boolean;
fs_device_filter: string[];
fs_type_filter: string[];
fs_virtual_mounts: string[];
disable_integrations: boolean;
Expand Down

0 comments on commit 5eb6efb

Please sign in to comment.