Hi.

I try to implement "sample_fetch_json_string" based on 
https://github.com/cesanta/mjson.
My current test looks good but I'm struggling with the test setup.

```
git-repos/haproxy$ ./haproxy -c -f ../test-haproxy.conf
[NOTICE] 097/012132 (1043229) : haproxy version is 2.4-dev15-8daf8d-30
[NOTICE] 097/012132 (1043229) : path to executable is ./haproxy
[ALERT] 097/012132 (1043229) : parsing [../test-haproxy.conf:9] : error 
detected in frontend 'fe1' while parsing
'http-request set-var(req.json)' rule : fetch method 'str' : expected ')' before 
',\"kubernetes.io/serviceaccount/namespace\":\"openshift-logging\",\"kubernetes.io/serviceaccount/secret.name\":\"deployer-token-m98xh\",\"kubernetes.io/serviceaccount/service-account.name\":\"deployer\",\"kubernetes.io/serviceaccount/service-account.uid\":\"35dddefd-3b5a-11e9-947c-fa163e480910\",\"sub\":\"system:serviceaccount:openshift-logging:deployer\"})'.

[ALERT] 097/012132 (1043229) : Error(s) found in configuration file : 
../test-haproxy.conf

```

That's the config.
```
defaults
        mode http
        timeout connect 1s
        timeout client  1s
        timeout server  1s

frontend fe1
        bind "127.0.0.1:8080"
        http-request set-var(req.json)  
'str({\"iss\":\"kubernetes/serviceaccount\",\"kubernetes.io/serviceaccount/namespace\":\"openshift-logging\",\"kubernetes.io/serviceaccount/secret.name\":\"deployer-token-m98xh\",\"kubernetes.io/serviceaccount/service-account.name\":\"deployer\",\"kubernetes.io/serviceaccount/service-account.uid\":\"35dddefd-3b5a-11e9-947c-fa163e480910\",\"sub\":\"system:serviceaccount:openshift-logging:deployer\"})'

```

I have tried several combos like.
str("...")
str('...')
str(...)
I have also added more '\' in the string.

But I get always the error above.

Any Idea how to fix the error?

Regards
Alex

Reply via email to