Forum Discussion

steven_yetter's avatar
steven_yetter
Contributor
2 years ago

Specifying configuration file on command line

We saw how to specify a variable with psvar on the command line, but we think we will have a lot of variables to specify.  I thought I would use a csv file or a json file and we are using python.  I saw the below on the internet for reading a json file, so it seems I should be able to use variable to get the fileName path.  Can I use this mechanism to apply variables for an entire project?  Is there a way to have variables that apply to an entire suite?

 

function test()
{
  var fileName = "d:\\testFile.json";
  var txt = aqFile.ReadWholeTextFile(fileName, aqFile.ctANSI);
  var obj = eval("(" + txt + ")");
  Log.Message(obj.Person[0].Name);
}

 

 

  • Having large number of variables can be cumbersome to manage, and documenting these is a thing of the past!

     

    I recommend using .ini (https://en.wikipedia.org/wiki/INI_file) to store your configurations settings, which can be easily modified.

     

    Alternative approach is to use ADO Components, where you can manually specify the connection string.

     

    • steven_yetter's avatar
      steven_yetter
      Contributor

      Does it matter how many?   For now I have 3,  projects_path, run_path.   The first would be the folder containing Isospeak (our app) projects to copy from,  the second would be the parent path to copy the project in projects_path for running.   We also will have export_path, and logs_path, and for right now, it is undecided.   But we would like one place to configure everything and we didn't think we wanted it inside the project.   I got a suite variable of DB_TYPE and browsed to config.csv and set 2 columns.    This code routine worked for getting a value out of the first row. 

       

      def Load():
             ProjectSuite.Variables.Config_DB.Reset()
             value = ProjectSuite.Variables.Config_DB.Value["run_path"]
            Log.message(value)

       

      Config_DB is the suite variable.  

       

      Is there a way to specify a path for Config_DB in the suite variables?  Right now it seems set to whatever I browse to for Default Value:

       

       

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Having large number of variables can be cumbersome to manage, and documenting these is a thing of the past!

     

    I recommend using .ini (https://en.wikipedia.org/wiki/INI_file) to store your configurations settings, which can be easily modified.

     

    Alternative approach is to use ADO Components, where you can manually specify the connection string.