91
Views
8
Comments
Environment Specific Resource file
Application Type
Traditional Web
Service Studio Version
11.53.24 (Build 61544)

Hi,

Is there any way we can keep environment specific resource file in OutSystems service studio?

Use Case:

We have 3 environments i.e. DEV, STAGING & PROD and we want to add a resource file(some config file) so that it gets deployed on each of these environments after publish/deploy. For any static file, we can achieve this by setting deploy action to "Deploy to Target Directory" however the content of this resource file will be different depending on the environment it is deployed to.

Is there any way to achieve this?

Note: This resource file has to be deployed/available in the module's target directory(root folder) for some core functionality to work.

Thanks!!

Hi Sandesh,

I would upload all three files in the same module and just reference them in different ways. Can you share more details what type of config files are these, and how are you providing the URL of the config file to your code?

I'd load all three and use a function to retrieve the environment (by path or site property) to select the correct one for each server.

The same Site Property can be used for other flows.

Hi Ravi & Nuno,

Thank you for your response.

The things is these config files are not used or referenced in our code in the module. It is just a config file that needs to be deployed in applications target directory on publish.

Ex. Let's say if we have DEV.config, STAGING.config & PROD.config under our Resources in Data tab; what we are looking for is if we publish on DEV environment it should ONLY deploy DEV.config; if we publish on STAGING it should use STAGING.config & same for prod it should use PROD.config while code publish/deploy.

These .config files are nothing but XML files which is used by performance monitoring agent to monitor the activity of that module and it is different for different environment like DEV, STAGING & PROD . Also, this .config file has to be in the applications target directory for monitoring agent to work properly like web.config OR Nlog.config

Is there any alternative to achieve this if not possible with resource files?

In short, looking for a way to deploy either resource file or alternative so that file gets deployed in apps target directory.

Thank you!!

Hi Sandesh,

I believe there's no way to make different application contents as you deploy from one environment to another. But with having 3 files available in the target directory and only one to be used in as an active config file would resolve your query, the remaining 2 config files will just stay in the target folder without being used.

Are you able to provide your config URL to the the third-party module, or needs to have it only inside a specific directory with a specific file name restricted? If it's a hard-configured file name, I would suggest changing that third-party module to allow receiving dynamic values for the config file, so you can pass the URL of the required config file depending on which environment you're operating in.

We may have more ideas if you clearly tell us about which module are you trying to configure.

Hi Ravi,

Thank you for your response.

Unfortunately, we can't change/pass anything to third-party service. It requires the specific file with required hard-configured file name in the apps target directory. 

Is there any way by which we can re-name the resource file & update it's deploy action in server action or timer action on publish?

OR

Generate such xml file at runtime by reading the value from site property & deploy in target directory?


Regards,

Sandesh Rane

There are many possibilities and options. We may have more ideas if you clearly tell us about which module are you trying to configure.

I'm wondering what's stopping you to share the name of library / module that you're using.

Hi.

I'm hijacking this thread, hope it's ok.

I have a good example/use case. OutSystem's official payment plugin. The plugin requires you to upload a .json config file, with a predefined name to a specific path. It must be located under: json-config/PaymentsPluginConfiguration.json

Unfortunately there is no way to dynamically change the path to this config file.

How would you solve this?

So it is not for OS site, but for IIS! Not my field. Although...

This reminds me of UltimatePDF and the required Chromium library. They have a plugin to install it in IIS. Maybe it can give you some ideas.

https://www.outsystems.com/forge/component-overview/11585/ultimate-pdf-management

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.