Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WebServerBundle] Added ability to display the current hostname address if available when binding to 0.0.0.0#28586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@respinoza
Copy link
Contributor

@respinozarespinoza commentedSep 24, 2018
edited by nicolas-grekas
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?? (no tests for server commands)
Fixed tickets#28585
LicenseMIT
Doc PRsymfony/symfony-docs#...

Tries to get the local hostname into an ip (if available) using the PHP gethostname* methods.

@nicolas-grekasnicolas-grekas changed the title[WebServerBundle] Added ability to display the current hostname addre…[WebServerBundle] Added ability to display the current hostname address if available when binding to 0.0.0.0Sep 24, 2018
@nicolas-grekasnicolas-grekas added this to thenext milestoneSep 24, 2018
/**
* @return string contains resolved hostname if available, empty string otherwise
*/
publicfunctiongetExtraAddress()

Choose a reason for hiding this comment

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

What about renaming this method asgetRealAddress() orgetResolvedAddress() ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@javiereguiluz will do, it reads better.

$io->success(sprintf('Server listening on http://%s',$config->getAddress()));
$message =sprintf('Server listening on http://%s',$config->getAddress());
if ('' !==$extra =$config->getExtraAddress()) {
$message =sprintf('%s (http://%s)',$message,$extra);

Choose a reason for hiding this comment

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

Not sure if we can hardcodehttp:// here. What if we are usinghttps:// in the local environment? Maybe it's better to detect that and add it in thegetExtraAddress() method.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@javiereguiluz we assume this as the php server won't support SSL, besides we already assume this in the original message.

javiereguiluz reacted with thumbs up emoji
$io->success(sprintf('Server listening on http://%s',$config->getAddress()));
$message =sprintf('Server listening on http://%s',$config->getAddress());
if ('' !==$extra =$config->getExtraAddress()) {
$message =sprintf('%s (http://%s)',$message,$extra);

Choose a reason for hiding this comment

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

To make it a bit easier to understand for users, we could change the output from this:

[OK] Server listening on http://0.0.0.0:8080 (http://172.20.0.2:8080)

to something like this:

[OK] Server listening on http://0.0.0.0:8080 (resolved as http://172.20.0.2:8080)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@javiereguiluz will do the change asresolved, this should also match the method name change (more consistent)

/**
* @return string contains resolved hostname if available, empty string otherwise
*/
publicfunctiongetResolvedAddress()

Choose a reason for hiding this comment

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

I'd suggest calling it getDisplayAddress actually (nothing is "resolved" to me)

Copy link
Member

Choose a reason for hiding this comment

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

Do you recommend to reword the message displayed to users too? Currently it says... (resolved as ...) I think it's easy to understand that way ... but may there's a better wording. Thanks!

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We already have a suggestion in the issue

[OK] Server listening on all interfaces, port 8080 -- see http://127.0.0.1:8080

@respinozarespinozaforce-pushed thedebug-server-show-host-too branch from6417342 todfd2e8bCompareOctober 9, 2018 12:01
@respinoza
Copy link
ContributorAuthor

Updated with the new messages, thanks to@jkufner suggestion, I believe the message now looks cleaner and conveys what we want.

@fabpot
Copy link
Member

Thank you@respinoza.

@fabpotfabpot merged commitdfd2e8b intosymfony:masterOct 10, 2018
fabpot added a commit that referenced this pull requestOct 10, 2018
… hostname address if available when binding to 0.0.0.0 (respinoza)This PR was merged into the 4.2-dev branch.Discussion----------[WebServerBundle] Added ability to display the current hostname address if available when binding to 0.0.0.0| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | ? (no tests for server commands)| Fixed tickets |#28585| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Tries to get the local hostname into an ip (if available) using the PHP gethostname* methods.Commits-------dfd2e8b [WebServerBundle] Added ability to display the current hostname address if available when binding to 0.0.0.0
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

5 participants

@respinoza@fabpot@javiereguiluz@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp