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 NGINX Agent config validation #1039

Open
wants to merge 5 commits into
base: v3
Choose a base branch
from
Open

Conversation

dhurley
Copy link
Collaborator

@dhurley dhurley commented Apr 4, 2025

Proposed changes

  • Improved logging to tell user what line in the agent config file is incorrect.
  • Agent now detects if a field in the config is unknown.
  • Updated default nginx-agent.conf file.

Example log messages:

2025/04/04 15:18:17 ERROR Failed to load configuration file error="[31:1] unknown field \"unknown_field\""
2025/04/04 15:19:07 ERROR Failed to load configuration file error="[25:11] cannot unmarshal string into Go struct field Config.Command of type int"

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@dhurley dhurley self-assigned this Apr 4, 2025
@dhurley dhurley requested a review from a team as a code owner April 4, 2025 14:22
@github-actions github-actions bot added chore Pull requests for routine tasks dependencies labels Apr 4, 2025
@dhurley dhurley added the v3.x Issues and Pull Requests related to the major version v3 label Apr 4, 2025
# host: "127.0.0.1" # Command server host
# port: 8080 # Command server port
# type: 0 # Server type (e.g., 0 for gRPC)
# host: "agent.connect.nginx.com"

Choose a reason for hiding this comment

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

Unsure why the host and port has been changed from localhost to this host?

@@ -5,7 +5,7 @@
#

log:
# set log level (error, info, debug; default "info")
# set log level (error, warn, info, debug; default "info")
Copy link
Contributor

Choose a reason for hiding this comment

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

Github wont allow me to click on the other file for some reason, but some of the test files have fatal as an option and dont have warn. The default also doesnt have warn as an option looking at it, should that be changed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks dependencies v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants