Hello,

In trying to rewrite some javascript, there are multiple places where a path is 
used as a raw string and as a value somewhere else in the code. For instance,

                    key: "searchPath",
                    get: function() {
                        return "jobs"
                    }

And:

                type: "jobs"

I want to replace the first “jobs”, but not the second one. The best I could 
come up with was this:


<rule dir="OUT" name="SERVICE/service/outbound/searchpath/jobs">
    <match pattern="return&quot;jobs" />
    <rewrite template="return&quot;{$frontend[path]}/jobs"/>
</rule>

<filter name="SERVICE/service/outbound/href">
        <content type="application/javascript">
            <apply path="return&quot;jobs" 
rule="SERVICE/service/outbound/searchpath/jobs" />


This results in:

                return "{$frontend[path]}/jobs"

The {$frontend[path]} shows up raw instead of being replaced. If I put that at 
the beginning of the template string, it gets replaced, but not if I put it 
where I need it. How can I work around this or should I look at contributing 
some code back to knox to change this behavior?

By the way, I hardcoded /gateway/{topology}/service into the rewrite template, 
which of course answers my own question. But I’m looking for a better 
workaround in case I need to use this service across topologies.

Thanks,

Billy Watson
Lead Platform Engineer, Parks Data Platform
Walt Disney Attractions Technology
7055 S Kirkman Rd, 225B, Orlando, FL 32819

Reply via email to