-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add ability to prompt for selected settings on startup #10918
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
Conversation
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.
I don't think this class should have a method with this kind of sideeffects. I thinks we should put all this stuff into
PromptPlaceholderResolver and have a method there with this signature:
public static Settings promtTerminal(Terminal terminal, Settings settings) {
// this method never modifies a builder we take the settings and build a new one and return
return newSettings;
}this way we don't need all the static maps in that class either and we don't need to access inner structures. In prepareSettings we call this as the last thing before we return the settings as the tuple.
does thsi make sense?
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.
Yeah it does make sense. The static map was more for issues that occurred when creating a Node within Bootstrap and having system properties with __prompt__. We can workaround that by not re-reading the system properties when building the node.
|
I left one comment. I also wonder if we should add a |
|
How would you know when to wipe the array? |
|
so there are multiple ways to do this. IMO there should only be ONE consumer. once the string is consumed we can wipe it. The other option is to have this thing MD5 or SHAxyz the input and never keep it around. |
|
I like the one consumer approach... It's then the responsibility of the consumer to properly handle it and as far as the settings is concerned it's been handled |
|
I will open the issue to add the |
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.
is that going to only be used for secrets? So it seems based on the code right now... in that case, I'd call it __promt_secret__ or something along those lines.
If the idea is to just keep it a generic prompt, then we'll need some sort of type indication here, like __prompt:secret__ vs. __prompt:text__ or __prompt:int__
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.
I think we should keep it generic. I think adding __prompt:secret__ and __prompt:text__ is the right thing to do. However, I don't see the need for other types since we store settings internally as a string or maybe I am missing something here?
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.
+1 for the two
|
I left one cosmetic comment - I will leave the final LGTM to @uboness here once you guys sorted out the different prompt options. |
|
@uboness updated the PR to support prompting for text and secret values |
|
@jaymode what's the status of this? |
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.
can we document why we do it (and make this a constant since we use it in several places now)?
|
looks great!, left one small comment |
|
added the constant and rebased to pickup other changes in bootstrap |
|
@jaymode ping |
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.
so, I've been thinking about it. We already have property place holders in the form ${...}. I think it'd be more consistent if we use the same form except with special syntax inside... something like: ${prompt::text}. @clintongormley wdyt?
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.
I'm good with that, and a strict YAML parser doesn't barf with this syntax, which is a bonus :)
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.
sorry :).. good with what? the original (i.e. __prompt:secret__) or the dollar sign option (i.e. ${prompt::text})?
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.
the dollar sign option :)
|
@jaymode I think we are good to go here now? |
|
I can live with pushing this for 1.6, just to have the functionality. But I would love to see this cleaned up and basically have all the placeholder replacement consolidated in the `replacePropertyPlaceholders' method. would love to see the system placeholders follow the same convention and be in the form: We can also introduce a new setting: will ignore all placeholder settings: config.ignore_placeholders: truewill only ignore config.ignore_placeholders: envwill only ignore config.ignore_placeholders: promptwill ignore both the config.ignore_placeholders: env, promptIt's a breaking change, so something to consider for 2.0? |
|
opened #11455 as discussion for these settings cleanups |
Some settings may be considered sensitive, such as passwords, and storing them
in the configuration file on disk is not good from a security perspective. This change
allows settings to have a special value, `${prompt::text}` or `${prompt::secret}`, to
indicate that elasticsearch should prompt the user for the actual value on startup.
This only works when started in the foreground. In cases where elasticsearch is started
as a service or in the background, an exception will be thrown.
Closes elastic#10838
In elastic#10918, we introduced the prompt placeholders. These were had a different format than our existing placeholders. This changes the prompt placeholders to follow the format of the existing placeholders. Relates to elastic#11455
In elastic#10918, we introduced the prompt placeholders. These were had a different format than our existing placeholders. This changes the prompt placeholders to follow the format of the existing placeholders. Relates to elastic#11455
Some settings may be considered sensitive, such as passwords, and storing them
in the configuration file on disk is not good from a security perspective. This change
allows settings to have a special value,
__prompt__, that indicates elasticsearchshould prompt the user for the actual value on startup. This only works when
started in the foreground. In cases where elasticsearch is started as a service or
in the background, an exception will be thrown.
Closes #10838