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

Can't pull server names out of enviroment variable #142

Open
curtisgibby opened this issue Jun 26, 2017 · 1 comment
Open

Can't pull server names out of enviroment variable #142

curtisgibby opened this issue Jun 26, 2017 · 1 comment

Comments

@curtisgibby
Copy link
Contributor

When you're building your list of server names, the current parsing of environment variables looks like this:

if (null !== getenv('BEANSTALK_SERVERS')) {
    foreach (explode(',', getenv('BEANSTALK_SERVERS')) as $key => $server) {
        $this->serversEnv[$key] = $server;
    }
}

I don't believe there's any way to correctly get $key from this without doing another explode (like exploding on = if your variable string were ServerA=servera.com:11300,ServerB=serverb.com:11300) or doing some other such string-wrangling a la parse_str. Do you have an example of this environment-variable format to extract both keys (human-friendly server names) and values (hostnames)?

@mkopinsky
Copy link

You're right - there's no way to get a (non-numeric) $key with the current code. I'm not using the environment variable approach myself, but taking a format like what you suggested seems reasonable, and would require another explode.

I'm not using environment variables myself, but if I get a +1 on this approach I can open a PR to this effect.

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