Skip to content

configure via environment variables #969

Open
@Jimbolino

Description

@Jimbolino

Summary

In our current setup we build a docker image that includes the newrelic-php-agent. The same docker image is deployed to different environments (testing, staging, production)
During the docker build stage, we write a newrelic.appname to the newrelic.ini file, this works, but we would like to add a variable from the environment to this, so we can more easily differentiate between staging and production environments.

Possible Solution

I've tried a solution where i've added the following lines to my php scripts

if (extension_loaded('newrelic')) {
    newrelic_set_appname('Dashboard PHP '.getenv('APP_ENV_NAME'));
}

But for some reason this does not seem to work with our laravel artisan queue worker (maybe because the queue runner forks a new worker process)

A better solution would be the possibility to use environment variables, either through the .ini file, or let the agent read the environment directly.

Additional context

Some people think the best way for configuration is via environment variables (https://12factor.net/config)
But maybe i missed something or there is a better solutions to this problem 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions