Skip to content

feat(config): add support for specifying port#7

Merged
scalvert merged 1 commit intomainfrom
rwjblue/push-srxtklwwmwqr
Apr 6, 2025
Merged

feat(config): add support for specifying port#7
scalvert merged 1 commit intomainfrom
rwjblue/push-srxtklwwmwqr

Conversation

@rwjblue
Copy link
Collaborator

@rwjblue rwjblue commented Apr 4, 2025

Often times you might need to configure a custom host or IP (e.g. for a proxy) and you might then need to specify a port for that connection to function. This adds support for that.

Note: This removes the validations of various hosts (e.g. you can specify any host, including an ip address), but it still supports using --host foo and having that expand to foo-be.glean.com.

  • Add port field to ConfigOptions struct
  • Update CLI flags and help text to include port option
  • Modify HTTP client to use port in base URL construction
  • Add support for foo.bar.com host format
  • Add tests for port configuration and URL building

@rwjblue rwjblue force-pushed the rwjblue/push-srxtklwwmwqr branch from 9c639b0 to 9cb9856 Compare April 4, 2025 04:53
@scalvert scalvert self-requested a review April 4, 2025 17:18
@rwjblue rwjblue force-pushed the rwjblue/push-srxtklwwmwqr branch from 9cb9856 to 794557c Compare April 4, 2025 18:10
@rwjblue rwjblue changed the title feat(config): add port configuration for local development feat(config): add support for specifying port Apr 4, 2025
@rwjblue rwjblue force-pushed the rwjblue/push-srxtklwwmwqr branch 2 times, most recently from 1661a39 to f849191 Compare April 4, 2025 18:19
Comment on lines -57 to -64
if !strings.HasSuffix(host, ".glean.com") {
return "", fmt.Errorf("invalid host format. Must be either 'instance' or 'instance-be.glean.com'")
}

if !strings.HasSuffix(strings.TrimSuffix(host, ".glean.com"), "-be") {
return "", fmt.Errorf("invalid host format. Must end with '-be.glean.com'")
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this allows usage of custom domains or IP's which is important to support the proxy use case.

Comment on lines -133 to -144
{
name: "invalid domain",
input: "linkedin.example.com",
wantErr: true,
errContains: "invalid host format",
},
{
name: "missing -be suffix",
input: "linkedin.glean.com",
wantErr: true,
errContains: "invalid host format",
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are removed because we actually do support this case now

Often times you might need to configure a custom host or IP (e.g. for a
proxy) and you might then need to specify a port for that connection to
function. This adds support for that. 

**Note:** This removes the validations of various hosts (e.g. you can
specify any host, including an ip address), but it still supports using
`--host foo` and having that expand to `foo-be.glean.com`.

- Add port field to ConfigOptions struct
- Update CLI flags and help text to include port option
- Modify HTTP client to use port in base URL construction
- Add support for foo.bar.com host format
- Add tests for port configuration and URL building
@rwjblue rwjblue force-pushed the rwjblue/push-srxtklwwmwqr branch from f849191 to 9f83ae9 Compare April 4, 2025 18:26
@scalvert scalvert merged commit 176bff7 into main Apr 6, 2025
4 checks passed
@rwjblue rwjblue deleted the rwjblue/push-srxtklwwmwqr branch April 6, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants