“Serve as” feature in EVA SFA

EVA SFA controller hosts “ui/” folder as static web content (except .j2 files), but you can perform a little trick on YAML and JSON files: convert them on the flow.

E.g. you have YAML file “config/test.yml” with content:

param1: 1
param2: somevalue

to get it as JSON, add “as=json” param to query string:

curl http://localhost:8828/ui/config/test.yml?as=json

and here it is as JSON:

{
    "param1": 1,
    "param2": "somevalue"
}

The feature also works in the opposite way – append “as=yml” to query string and JSON files will be converted to YAML.

And another lazy trick – get JSON, but already pre-loaded in JavaScript variable. E.g. you have some static data for web UI application and want to load it with <script> tag:

<script type="text/javascript"
  src="config/test.yml?as=js&var=config"></script>

the result will be:

config={"param1": 1, "param2": "somevalue"}

This feature will be officially available in EVA ICS 3.2.3 but is already back-ported to 3.2.2, starting from build 2019052801. Enjoy! 🙂