Static file config in middleware.json is remove after update datasource
After i update datasource by use slc arc, all config static file in middleware.json is removed. I use strongloop v5.0.0 (node v2.4.0). Please fix it.
This sounds like a serious issue. Are you saying that the middleware.json file is removed or something within the middleware.json is? Do you have some reproduction steps for this? Are you using arc and editing the file at the same time?
Only config static file in field "files" is remove. I use slc arc in my project then go to datasource choice Test Connection after that filed "files" in middleware.json is become "files": {}.
Are you using arc and editing the file at the same time? I only use arc
This sounds like an issue in the workspace API.
@raymondfeng can you take a look since you added middleware support recently?
I was unable to reproduce this. I modified the files property in middleware.json then added a new datasource in Arc and clicked Test. The middleware.json file was unaffected.
@PhuongNL By default the middleware.json created by slc loopback has
"files": {
},
So unless you are manually editing middleware.json, that's what you should see.
See http://docs.strongloop.com/display/LB/Add+a+static+web+page.
I know the problem. Here is my config static file in middleware.json:
"files": {
"loopback#static": [
{
"paths": [
"/"
],
"params": "$!../client"
},
{
"paths": [
"/bower_components"
],
"params": "$!../bower_components"
}
]
},
when i test connection in arc all static file is remove. After that i edit middleware.json to:
"files": {
"loopback#static":
{
"paths": [
"/"
],
"params": "$!../client"
}
},
Everything is still there. Maybe has issue in static file at version 5.0.
One more thing, please support iojs >= 2.4.
@PhuongNL It seems loopback#static entries pointing to non-existent files are removed. I'll check.
OK, I reproduced the problem with the above "files" entry. As soon as I click Test Connection the entry disappears from middleware.json. It didn't seem to matter if I had a client or bower_components directory.
Hi @crandmck, I was unable to reproduce the files entries being removed, not sure if I'm following the procedures wrong or if the issue has been resolved.
Moving the follow block of text to correct issue #1833 instead,
But on the otherhand, any keys in the following object seems to be removed if the user uses them, in one case the user was using name in their middleware.json it was removed from
middleware.jsonwhere it doesn't happen fromnode .only fromworkspace-api{ "configFile": "server/middleware.json", "phase": "initial", "facetName": "server", "name": "compression", "order": 2049, "index": 0, "id": "initial.compression" }
Just to note some behaviors in my investigation of the current version.
- collection with only one object becomes an object
- parameters such as
configFile,name,order,index,idare reserved and does not preserve uponmiddleware.jsonrewrite fromMiddleware.seralize()- parameters such as
phase,subPhasein aloopback#staticentry seems to break the code.file->loopback#staticentries pointing to non-existent folders do preserve
Hi @crandmck, I believe this(non-existing path files entry removed) is no longer as issue, would you be able to see if you also can no longer reproduce this issue, then this issue can be closed . Thanks!
@davidcheung I tried it again and was not able to reproduce. So, I assume the problem is fixed in the latest release.