Skip to content

Commit 3e3fde0

Browse files
committed
fix(hostd): address configuration hostname no port
1 parent 18376c4 commit 3e3fde0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.changeset/sharp-ears-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'hostd': minor
3+
---
4+
5+
The address configuration setting now expects only the hostname without a port. Closes https://github.com/SiaFoundation/hostd/issues/536

apps/hostd/contexts/config/fields.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from './types'
1111
import { calculateMaxCollateral } from './transform'
1212
import { currencyOptions } from '@siafoundation/react-core'
13+
import { Maybe } from '@siafoundation/types'
1314

1415
type Categories = 'host' | 'pricing' | 'DNS' | 'bandwidth' | 'RHP3'
1516

@@ -46,9 +47,16 @@ export function getFields({
4647
category: 'host',
4748
title: 'Address',
4849
description: <>The network address of the host.</>,
49-
placeholder: 'my.host.com:9982',
50+
placeholder: 'my.host.com',
5051
validation: {
5152
required: 'required',
53+
validate: {
54+
noProtocol: (value: Maybe<string>) =>
55+
!/^https?:\/\//.test(value || '') ||
56+
'must not start with http:// or https://',
57+
noPort: (value: Maybe<string>) =>
58+
!/:\d+$/.test(value || '') || 'must not include port',
59+
},
5260
},
5361
},
5462
maxContractDuration: {

0 commit comments

Comments
 (0)