Accessing System variables / Data

How do you go about accessing the various variables that are setup in the system. Such as “url” or “db_con_string” as setup in the oxygen.env.js file?

If I have set the Env via Settings as “Test”

Also when running via CLI how do I reference the Environment variables there also?

--------------- Pasted directly from your site -------------------

module.exports = {

TEST: { 
    url: 'https://test.wikipedia.org',
    db_con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=test;'
    username: 'test.user',
    password: 'test123'
},

PROD: {
    url: 'https://wikipedia.org',
    db_con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=prod;',
    username: 'username',
    password: 'password'
},

}


OK: I have figured out how to access the Environment data inside of the Oxygen UI.

with your oxygen.env.js file created as above

you can access it by using “env.url” anywhere in any of your js files.

You can also access the whole object stack with “ox” and you can access the oxygen.po.js file with “po”. do a web.debug(ox) and you will get the whole object. Copy paste it into a json editor and replace :undefined with :“undefined” to make it valid json. This will show you all the system data that can be accessed.

OXYGEN TEAM:

What I can’t get to work yet is getting the environment variable to be read in the oxygen.conf.js file.
I have it setup like this as per a blurb on your site:

environment: {
some_parameter: “foo”,
another_parameter: “bar”
},

doing a log.debug(ox.options);

Shows both of my Environments I have configured, as well as my po objects… but it won’t set the env: variable with the selected environment.

Selecting an environment works fine in the UI to run scripts but can’t get it configured for cli.

Setting your environment for CLI Scripts:
oxygen.env.js
ENV1: {
some_parameter: “foo”,
another_parameter: “bar”
},
ENV2: {
some_parameter: “bar”,
another_parameter: “foo”
},

oxygen.conf.js - Just reference the name of the Env from the Environment file.


capabilities: […

environment: ‘ENV2’,

parameters : […

No thanks to the oxygen team… figured it out myself… so others can use it.