a way to store environment variable for custom package

Hi Everyone,

I'm wondering if there is a way to store any environment variable in SugarCRM for my custom package?

For example, I have a API key in my package, and I don't want to write the string directly in my package.

Thanks a lot!

Sophie

Parents
  • - If the instance is hosted in the cloud one way of doing it would be ask Sugar if they can set the variabel in the config. 

    - We used the connector part for it in the past. So we created a 'dummy' connector where we can set the settings we need

    - now we use our own configuration module that stores the settings in the configuration for us. Since its a normal module we can change the settings in the ui and hit 'store in config'

    - Last but not least you could use the api /Administration/config/:category  to set a config variable in the database that you read in your packag when you want. 

  • I haven't seen it stated here but you can also access the config table in sidecar if the category is a module name.


    var config = app.metadata.getModule('Accounts', 'config');
    if(!_.isEmpty(config.ns_url)) {
        url = config.ns_url;
    }
    

    Note that you need to repair and rebuild for the client to get new values added to the config table.

Reply Children
No Data