Best practices for setting the environment variables for a custom build application?

Respondidas


Publicado 01 may 2017

I did built a custom app that integrate another system into the Zendesk UI for our company.

The application is working very well and I'm getting ready to deploy it into the production environment.

There are few variables that hold connection information that will need to switch between values based on the environment where it is deployed.

Those variables holds url's for web services, database connection strings, logging setup...

I would like to know if there are best practices for setting and managing those  environmental variables to be easy to deploy the app in different environment?

 


0

19

19 comentarios

It does seem odd at first why all settings are not treated the same way. The reason is because secure settings, due to their nature, are never meant to be seen on the client side, so they have to be treated differently. The only point that they are retrieved and inserted into a client.request call is on the backend proxy server that Zendesk hosts.

This enables an administrator to confidently enter, say, a remote server's API token and not have to worry about anyone on the client side having access to that value. Hope this clarifies things!

0


Why are secure parameters not returned by client.metadata() ? Also, if your app is using metadata variables how do you expose them for local development?

0


Hi Mark-

Unfortunately, this isn't possible with our apps framework, you can't modify the metadata settings in this fashion. This API can be used to update settings values of an app, but note it is only available to admins.

0


Hello Devan,

 

yes I would be talking about a custom built app.

 

Like would it be (if the manifest parameter is "default_form")...

client.invoke("metadata.settings.default_form.save", updated_default_form);

or

client.metadata("settings.default_form", updated_default_form);

or

metadata_var['settings']['default_form'] = updated_default_form

client.metadata(metadata_var);

?

 

Thanks,

Mark DiValerio

 

0


Hello Mark,

It would depend on which app are you are referring to. Typically, it won’t be possible, but you could always build your own app, depending on the behavior you want/don’t want,

Best regards.

0


Can you modify the metadata settings from within the app?

 Scenario: I want to create a form, questions and radio button/dropdown answers as a sidebar app. The Q&A are pulled from the metadata, but i would like to add a feature that allows users of a particular group to be able to modify the form. Once i do that, can I save the new Q&A back into the metadata so that when another person loads the app, it loads the new form?

 

(Or is there a better, more proper way to do this?)

 

Thanks

0


All makes sense, but I have found that I don't seem to be able to access `secure` settings with client.metadata(). Is this supported? If not, how do I access them? I have a client_id and a client_secret that I need to base64_encode to make an initial authentication request to an external API.

0


Thanks for sharing the final code, Sorin.

And, Cedric, thanks for all the help you gave.

Glad it worked out!

0


Cedric,

Thank you again for your help.

I'm now able to set and use the custom environmental variables for my app.

I post here the code that worked, it may help other people, as many examples on the web are for v1 framework and they do not seems to work for v2

var zendeskAcsWSurl = '';

var client = ZAFClient.init();

// get the metadata settings
client.metadata().then(function (metadata) {
   // assigning the web service base url from the configuration files
   zendeskAcsWSurl=metadata.settings.ACSServiceBaseUrl; 
   //console.log(metadata.settings);
});

0


Hey Sorin,

I had some time and made this one for you:

{
"name": "ACS Customer Information",
"author": {
"name": "s v",
"email": "sv@xxx.xxx",
"url": ""
},
"defaultLocale": "en",
"private": true,
"location": {
"support": {
"ticket_sidebar": "assets/iframe.html"
}
},
"parameters": [
{
"name": "ACSServiceBaseUrl",
"type": "text",
"secure": false,
"required": true,
"default": "yoursubdomain",
}
]
"version": "1.0",
"frameworkVersion": "2.0"
}

So I added parameters and moved "ACSServiceBaseUrl". This is the name of your parameter, which will be provided as text and the default filled in will be "yoursubdomain".

Good luck with it :)

0


La publicación no admite más comentarios.

¿No encontró lo que buscaba?

Nueva publicación