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
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
- 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.
One more question please, Jeroen:
is it safe to write directly my KEY directly in the custom package?
I wouldn't rely on it. The package is, with normal use, not retrievable by the user since the package is stored in the upload directory (if i'm correct). Only way to retrieve your package is to download a backup or gain direct access to filesystem of the instance (by which the retrieval of your key, if that is happening, the least of your concerns) On the other hand if you provide the package on a publicly downloadable place I would never set the key in the package itself.
I wouldn't rely on it. The package is, with normal use, not retrievable by the user since the package is stored in the upload directory (if i'm correct). Only way to retrieve your package is to download a backup or gain direct access to filesystem of the instance (by which the retrieval of your key, if that is happening, the least of your concerns) On the other hand if you provide the package on a publicly downloadable place I would never set the key in the package itself.
I see, Jeroen. Thanks for quickly reply.
Then I guess I don't need to worry about it. Because my package is only uploaded to our cloud instance.
And you're right that only way to retrieve it is to download a backup or gain direct access to filesystem of the instance.
1. As for download a backup, only Sugar and our users can do that I guess
2. And the file system is only accessible to SugarCRM.
If I use API to set a config variable in my database,
it is mentioned that the endpoint is only available for administrators.
My use case is:
I create a custom package which will trigger an URL "after save" of any contacts.
Then when some normal user clicks 'save' in module, will the URL still be triggered?
Million thanks!
Sopie
if a user hits save on a contact the after_save logic hook is always triggered. But would that send out data from the contact to another system? Why not have it being flagged and have a scheduler read all the records that are flagged? This way if on the after_save the external system isn't reachable the user doesn't get any errors.
Yes, you're right, on "after save", it will send data to my URL which has an API Key.
Thank you for your suggestion