Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove schema prefix in ServersArePingable check #70

Open
akalongman opened this issue Jan 14, 2019 · 3 comments
Open

Remove schema prefix in ServersArePingable check #70

akalongman opened this issue Jan 14, 2019 · 3 comments

Comments

@akalongman
Copy link

akalongman commented Jan 14, 2019

It would be very useful if there was an option per host for removing schema prefix (http://, https://), because when I want to use hostname from the config, like config('app.url'), it's very inconvenient to remove prefixes for each host.
Something like:

\BeyondCode\SelfDiagnosis\Checks\ServersArePingable::class => [
    'servers' => [
        [
            'host'    => config('app.url'),
            'port'    => 80,
            'timeout' => 1,
            'remove_schema' => true,
        ],
    ]
]

@mpociot If you agree with the idea, I can implement and send PR

@akalongman
Copy link
Author

akalongman commented Jan 14, 2019

Or maybe just allow strings like http://myhost.com:8080 and get host/port from there?

@Namoshek
Copy link
Contributor

Why don't you use something like parse_url(config('app.url'), PHP_URL_HOST)? Of course we could add further options, but it seems like a solid solution to me to only pass the actual host.

If we went for your solution, I would implement it properly and offer

\BeyondCode\SelfDiagnosis\Checks\ServersArePingable::class => [
    'servers' => [
        [
            'url' => 'https://some.host.com:2468',
            'timeout' => 1,
        ],
    ]
]

as alternative for

\BeyondCode\SelfDiagnosis\Checks\ServersArePingable::class => [
    'servers' => [
        [
            'host'    => 'some.host.com',
            'port'    => 2468,
            'timeout' => 1,
        ],
    ]
]

@akalongman
Copy link
Author

If we went for your solution, I would implement it properly and offer

It's same what I suggested in the previous comment

Or maybe just allow strings like http://myhost.com:8080 and get host/port from there?

And I like this solution

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

No branches or pull requests

2 participants