Build hybrid application based on profile/configuration

What product/components do you use and which version/fix level are you on?

Cumulocity IoT (backend 1011.0.19 frontend 1011.0.4)

Is your question related to the free trail, or to a production (customer) instance?

Customer license

Hi it’s Luca

I’m developing an application starting from cockpit. I need to build my app using different profiles/configuration. For example, I need to show a component while im developing but hide it in production. To solve this from an Angular perspective we have environtment.ts and angular.json configuration (there’s no need to exaplain this solution in detail). Then we can just build the application with something like
ng build --configuration=dev or ng build --configuration=production

Unfortunately in my scenario (hybrid application) I have neither environment.ts nor angular.json.

How can I solve this?

Hi Luca,

The following syntax allows you to set certain attributes on your app while building/serving the app:

--app.<key>=<value>

So you could e.g. build the app using:

c8ycli build --app.name=MyCustomName

To rename the app to MyCustomName.
This can also be used to adjust any other of the default application options.

You are also free to define you own options and set them as described above.
You can then access these option inside of your application using the OptionsService. If this doesn’t work for you, you should also be able to access them via window.C8Y_APP.<attribute> within your application.

Regards,
Tristan

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.