Added warnings when port 80 may clash.#110
Merged
Merged
Conversation
cb11fc8 to
a17bf5b
Compare
gthomas2
reviewed
Mar 3, 2026
| * Uses a short TCP connection attempt for portability across OS. | ||
| */ | ||
| public function isPort80InUse(): bool { | ||
| $fp = @fsockopen('127.0.0.1', self::PROXY_PORT, $errno, $errstr, 1); |
Collaborator
There was a problem hiding this comment.
nice, this is a really neat way of doing it as it should work with any operating system.
gthomas2
reviewed
Mar 3, 2026
| * When proxy mode is enabled: if port 80 is in use and not by mchef-proxy, warn that proxy mode will not work. | ||
| * Call from: config --proxy (when enabling), mchef up, and when creating instance from recipe. | ||
| */ | ||
| public function warnIfPort80BlockedForProxy(): void { |
Collaborator
There was a problem hiding this comment.
Please change this to
public function warnIfPort80BlockedForProxy(bool $skipEnabledCheck = false): void {
if (!$skipEnabledCheck && !$this->isProxyModeEnabled()) {
return;
}
gthomas2
reviewed
Mar 3, 2026
|
|
||
| private function setProxy(bool $proxy) { | ||
| if ($proxy) { | ||
| $this->proxyService->warnIfPort80BlockedForProxy(); |
Collaborator
There was a problem hiding this comment.
Please see my comment about suggested change to warnIfPort80BlockedForProxy and change this to
$this->proxyService->warnIfPort80BlockedForProxy(true);
If we don't force the warning to skip the config check, we won't see the warning here because the configurator hasn't had chance to turn on "useProxy" yet.
gthomas2
requested changes
Mar 3, 2026
Collaborator
gthomas2
left a comment
There was a problem hiding this comment.
just a small bug that needs fixing regarding not warning if config isn't set
Collaborator
Author
|
Thanks for the comments @gthomas2 I've added another commit addressing them. |
gthomas2
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #109