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

Add TOML configuration file support #1238

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Tatsh
Copy link

@Tatsh Tatsh commented Oct 15, 2024

Overview

This adds support for reading configuration from a TOML file such as pyproject.toml to reduce clutter.

Layout is:

[tool.newrelic]
app_name = "app name"

Keys with . in them are expanded to be subkeys:

[tool.newrelic.browser_monitoring]
enabled = true

Anything that is a list in the layout is made into a string joined with a single space.

import-hook:... is translated as such and requires quotes in the keys:

[tool.newrelic.import-hook.module_name]
"sub.sub" = ["item1", "item2"]

error_collector.ignore_errors:

[tool.newrelic.error_collector]
ignore_errors = ["module.name:ClassName", "module.name:ClassName2"]

Environments use the tool.newrelic.env namespace:

[tool.newrelic.env.production]
app_name = "production name"

Expansion of the subkeys includes doing so in an environment section:

[tool.newrelic.env.production.transaction_tracer]
enabled = false

Related Github Issue

#1229

Testing

Tests have been added.

Layout is:

[tool.newrelic]
app_name = "app name"

Keys with . in them are expanded to be subkeys:

[tool.newrelic.browser_monitoring]
enabled = true

Anything that is a list in the layout is made into a string joined with a single space.

import-hook: is translated as such:

[tool.newrelic.import-hook.module_name]
"sub.sub" = ["item1", "item2"]

error_collector.ignore_errors:

[tool.newrelic.error_collector]
ignore_errors = ["module.name:ClassName", "module.name:ClassName2"]

Environment use the tool.newrelic.env namespace:

[tool.newrelic.env.production]
app_name = "production name"
@Tatsh Tatsh requested a review from a team as a code owner October 15, 2024 03:28
@CLAassistant
Copy link

CLAassistant commented Oct 15, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Tatsh
❌ mergify[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

2 participants