Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Serve static assets from NP #60490
Serve static assets from NP #60490
Changes from 11 commits
a3cc842
9bb4937
aaafdc6
475a5c3
6aa6e56
fabb201
a2394df
e03576a
05e026c
0dec6ca
048c385
70e9ffc
dc10e99
3d7dcb0
862d230
d0678c9
3021e43
59759d7
753f2c4
38fb7be
9912b9a
30effed
ce9fbb5
4aad487
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 open to the other options. we can place them under
src/core/server/assets
, for example.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 know this PR doesn't yet expose this to plugins directly, but I wonder if there's really any value into allowing/requiring plugins to add the
{path*}
part of the path string. Should we do this for them automatically?I think that if there is a real use case to only serving files of a certain directory depth, this should be exposed more explicitly via an option to
registerStaticDir
:Can be dealt with in PR that exposes to plugins. Just wanted to note while I thought about it. Also if there's no current need to specify the depth we probably don't need this option at all and should just automatically append the
/{path*}
when we register the route with Hapi.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 we should expose this API directly to the plugins. Otherwise, any plugin can expose an arbitrary folder (config folder with
kibana.yml
, for example)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.
We expose
/public
directory in the LP automatically:kibana/src/legacy/plugin_discovery/plugin_spec/plugin_spec.js
Lines 164 to 174 in 85c8232
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.
We could have an API to only allow to serve from within the plugin's base folder. That would avoid the risk of exposing files from outside their folder.
i.e
that would serve the
src/core/plugins/my_plugin/my_assets_folder
(or maybesrc/core/plugins/my_plugin/server/my_assets_folder
, need to decide)I agree, that doesn't seems necessary imho
Previous proposal example should probably be
Don't really see any obvious need for that. KISS imho.
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.
If we don't need to expose to plugins, then as-is is good with me 👍
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.
Wow. We sure were doing fun things.
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.
fixed type errors
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.
LP exposes the whole folder https://github.com/elastic/kibana/pull/60490/files#diff-15c0a3d71c405cd45e19b0114aecb64eR76
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.
How should we document this feature?
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 added docs to the migration guide. Let me know if I can improve something.
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 a temporary measure to allow plugins to move their static assets to NP plugins until #50654 lands? Didn't we want to make all assets exposition explicit? Or is this going to be permanent to allow client-only plugins to expose assets?
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 on the fence here. On the one hand, we prefer explicitness, but it increases the API surface, makes a folder structure less predictable, enforces server-side plugin usage.
If we decide to add explicit API, it would be something locked within the
plugin
folder. As you proposed in #60490 (comment)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 we want to server build artifacts from the
/assets
folder, so I separated them.