Skip to content

Commit

Permalink
fix(hostd): address configuration hostname no port
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Dec 19, 2024
1 parent 7c3f4b1 commit 6731a21
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-ears-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The address configuration setting now expects only the hostname without a port. Closes https://github.com/SiaFoundation/hostd/issues/536
2 changes: 1 addition & 1 deletion apps/hostd-e2e/src/fixtures/configResetAllSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const configResetAllSettings = step(

// host
await setSwitchByLabel(page, 'acceptingContracts', false)
await fillTextInputByName(page, 'netAddress', 'foobar.com:9880')
await fillTextInputByName(page, 'netAddress', 'foobar.com')
await fillTextInputByName(page, 'maxContractDuration', '6')

// pricing
Expand Down
4 changes: 2 additions & 2 deletions apps/hostd-e2e/src/specs/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('basic field change and save behaviour', async ({ page }) => {

// Test that values can be updated.
await setSwitchByLabel(page, 'acceptingContracts', true)
await fillTextInputByName(page, 'netAddress', 'foobar.com:7777')
await fillTextInputByName(page, 'netAddress', 'foobar1.com')
await fillTextInputByName(page, 'maxContractDuration', '7')
await fillSelectInputByName(page, 'pinnedCurrency', 'AUD')
await fillTextInputByName(page, 'pinnedThreshold', '7')
Expand All @@ -48,7 +48,7 @@ test('basic field change and save behaviour', async ({ page }) => {
// await expect(
// page.getByText('Address has changed, make sure to re-announce the host.')
// ).toBeVisible()
await expectTextInputByName(page, 'netAddress', 'foobar.com:7777')
await expectTextInputByName(page, 'netAddress', 'foobar1.com')
await expectTextInputByName(page, 'maxContractDuration', '7')
await fillSelectInputByName(page, 'pinnedCurrency', 'USD')
await expectTextInputByName(page, 'pinnedThreshold', '7')
Expand Down
10 changes: 9 additions & 1 deletion apps/hostd/contexts/config/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from './types'
import { calculateMaxCollateral } from './transform'
import { currencyOptions } from '@siafoundation/react-core'
import { Maybe } from '@siafoundation/types'

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

Expand Down Expand Up @@ -46,9 +47,16 @@ export function getFields({
category: 'host',
title: 'Address',
description: <>The network address of the host.</>,
placeholder: 'my.host.com:9982',
placeholder: 'my.host.com',
validation: {
required: 'required',
validate: {
noProtocol: (value: Maybe<string>) =>
!/^https?:\/\//.test(value || '') ||
'must not start with http:// or https://',
noPort: (value: Maybe<string>) =>
!/:\d+$/.test(value || '') || 'must not include port',
},
},
},
maxContractDuration: {
Expand Down

0 comments on commit 6731a21

Please sign in to comment.