-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Override default variables with SystemConfig #854
Override default variables with SystemConfig #854
Conversation
This commit partially cherry-picked: fluent@0d4bde5
a13cb72
to
e8a31e3
Compare
Oh, NTFS does not support UNIX like permissions! |
5dff253
to
e7d5fa0
Compare
@@ -31,6 +31,33 @@ def system_config_override(opts={}) | |||
@_system_config.send(:"#{key.to_s}=", value) | |||
end | |||
end | |||
|
|||
def listen_port_override(port=DEFAULT_LISTEN_PORT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
system_config_override
is to override instance variables for each plugin instances. Once it was overridden, following system_config
method refers instance variable, not global system config instance.
(In other words, plugin just refer system_config
even in tests after system_config_override
is called in setup
or somewhere else.)
So, there's no need to add xxx_override
methods.
Default values of port, permission and others are for each plugins, not for Fluentd global.
Especially for file/directory permissions, it's better to provide system config parameters because there's not so variations about it (in many cases, permission control policy is system-wide). perm = @perm_param_of_plugin || system_config.file_permissions || PLUGIN_DEFAULT_PERM |
e7d5fa0
to
524c44f
Compare
524c44f
to
654e4b3
Compare
@@ -46,6 +46,13 @@ class SystemConfig | |||
config_param :rpc_endpoint, :string, default: nil | |||
config_param :enable_get_dump, :bool, default: nil | |||
config_param :process_name, default: nil | |||
config_param :listen_port, :integer, default: nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this line?
There's no need to configure system-wide listen_port
because this configuration cannot be shared by anything.
Removing this line also makes port_override
methods useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll do it.
* DEFAULT_LISTEN_PORT is removed and nothing adding config_params
2f72613
to
3766e13
Compare
@tagomoris How about this? Can we merge this? |
LGTM. I'll merge this right now. |
Thanks! |
I've implemented to override default variables with system config mechanism.
This PR is related to this developer task: make process global constants obsoleve in fluent/env
ref: https://github.com/fluent/fluentd/wiki/Developer-notes-for-fixes-on-v0.14#plugin-miscellaneous
Remaining Task(s)
perm = @perm_param_of_plugin || system_config.file_permissions || PLUGIN_DEFAULT_PERM
in pluginQuestion(s)
Where is suitable place to put into obsoleted variables? Or, leave them as-is is enough?Solved.