loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Variables cannot be concatenated with rest string in middleware.json

Open f-w opened this issue 10 years ago • 8 comments

Defining middleware documented how to use variables in file middleware.json. It works if the variable takes entire string value, but not if the value contains other string. For example, if clientRoot = /ext, then following static config resolves /ext by "${clientRoot}", but /ext/foo cannot be resolved by "${clientRoot}/?*". If I replace "${clientRoot}/?*" with hard-coded "/ext/?*" then it works.

  "files": {
    "loopback#static": [
      {
        "paths": [
          "${clientRoot}",
          "/"
        ],
        "params": "$!../client/dist"
      },
      {
        "paths": [
          "${clientRoot}/?*"
        ],
        "params": "$!../client/dist"
      }
    ]
  },

f-w avatar Jun 20 '16 21:06 f-w

We currently replace the whole variable value and don't support having the variable as part of the path.

Another user requested the same feature: https://github.com/strongloop/loopback-boot/pull/181#issuecomment-216433322

0candy avatar Jun 21 '16 20:06 0candy

+1

jdhrivas avatar Jan 05 '17 23:01 jdhrivas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 23 '17 14:08 stale[bot]

I have the same issue , I have to use hard code now : "parse": { "body-parser#raw": { "paths": [ "/api/v1/Buckets/?/upload" ] } }, But expect the following one : "parse": { "body-parser#raw": { "paths": [ "${restApiRoot}/Buckets/?/upload" ] } },

caiyufei avatar Aug 24 '17 07:08 caiyufei

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 23 '17 08:10 stale[bot]

go away stale bot

ashwell avatar Oct 23 '17 19:10 ashwell

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 22 '17 19:12 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Jan 05 '18 20:01 stale[bot]