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

Allow specifying exactly what type of database string is expected in the database section for trace configuration #8427

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Noremos
Copy link
Contributor

@Noremos Noremos commented Feb 3, 2025

The new syntax:

database = name /var/primary-db.fdb  
{  
enabled = true  
log_errors = true  
}  

database = name /var/secondary.fdb  
{  
enabled = true  
log_connections = true  
}  

database = regex (%[\\/](e[[:DIGIT:]]{{2}}).fdb)  
{  
enabled = true  
}  

# Default behavior for backward compatibility  
database = %[\\/]my_database.fdb  
{  
enabled = true  
}  

I chose database = name path.fdb over database name = path.fdb because it is easier to implement and parse, but it doesn't look as great, so it can be reimplemented.

Copy link
Member

@hvlad hvlad left a comment

Choose a reason for hiding this comment

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

Please, avoid massive not related changes such as end space trimming.
It makes harder to read the patch looking for valuable changes.

@hvlad
Copy link
Member

hvlad commented Feb 3, 2025

I chose database = name path.fdb over database name = path.fdb because it is easier to implement and parse, but it doesn't look as great, so it can be reimplemented.

Consider databaseName = path or databaseByName = path.

Note, in proposed syntax database name path.fdb also accepted, as = is not required by config code.

Also, your sample is wrong as default section must be the first one.

@Noremos
Copy link
Contributor Author

Noremos commented Feb 3, 2025

Please, avoid massive not related changes such as end space trimming. It makes harder to read the patch looking for valuable changes.

Sorry, my IDE automatically trimmed the spaces and didn't display them in the DIFF editor

@Noremos
Copy link
Contributor Author

Noremos commented Feb 3, 2025

I chose database = name path.fdb over database name = path.fdb because it is easier to implement and parse, but it doesn't look as great, so it can be reimplemented.

Consider databaseName = path or databaseByName = path.

Now databaseName and databaseRegex are used

database
{
	enabled = false
}

databaseName = /var/primary-db.fdb
{
	enabled = true
	log_errors = true
}

databaseRegex = (%[\\/](e[[:DIGIT:]]{{2}}).fdb)
{
	enabled = true
}

database = employee
{
	enabled = true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants