Skip to content
Deva Kumar edited this page May 27, 2020 · 1 revision

appenv route

The restaf-server supports a special route /{APPNAME}/appenv which returns two objects

  1. LOGONPAYLOAD
  2. APPENV

Usage

In your html include the following script tag

<script src="/{yourappname}/appenv></script>

Example:
<script src="/viyaapp/appenv><script>

This will result in two js objects named LOGONPAYLOAD and APPENV to be populated.

LOGONPAYLOAD

This object has information that are useful for connecting to SAS Viya.

let LOGONPAYLOAD = {
      authType : <value of AUTHFLOW>
      redirect : <here for backward compatability>
      host     : <value of VIYA_SERVER>,
      clientID : <here for backward compatability>,
      appName  : <value of APPNAME>,
      keepAlive: <null or url for the /{APPNAME}/KEEPALIVE route>
};

LOGONPAYLOAD usage notes

1 host - useful for making REST calls to SAS Viya and as parameter to VA-SDK. Use this (LOGONPAYLOAD.host) to avoid hard-coding the viya server in the application

2 appName - this is the application name set by the APPNAME value in the env file

3 keepAlive - it is either null or the url to the keepAlive route in the app server

Note for restaf users: Pass LOGONPAYLOAD to store.logon

APPENV

This object is whatever was returned from js function set as the appenv parameter when starting the application server. This is convenient way to configure your application for different scenarios.

Clone this wiki locally