Configuring Environmental Variables for Scripts

Certain scripts utilized in our workflows, such as clean_spec_csv_to_excel.py, fmrest_barcode, and digitization_performance_tracker.py, and fetch_and_export_fm_data.py, require specific environmental variables to be set in your .zshrc file to function correctly. These variables typically include API keys, tokens, configuration settings, and database credentials necessary for the scripts to interact with external services like Trello, FileMaker, and AMI Database.

Setting up Environmental Variables:

  1. Open your Terminal application.
  2. Access your .zshrc file by typing:
    open -e ~/.zshrc
    

    This command will open your .zshrc file in TextEdit. If the file does not exist, it will be created.

  3. Add the required environmental variables. Below are examples of how you might configure your .zshrc for our specific scripts:

    • For clean_spec_csv_to_excel.py, which interfaces with Trello:
      export TRELLO_API_KEY='your_trello_api_key'
      export TRELLO_TOKEN='your_trello_token'
      export TRELLO_LIST_ID='your_trello_list_id'
      
    • For fmrest_barcode, which requires FileMaker server details:
      export FILEMAKER_SERVER='your_filemaker_server'
      export FILEMAKER_DATABASE='your_filemaker_database'
      export FILEMAKER_LAYOUT='your_filemaker_layout'
      
    • For digitization_performance_tracker.py, which requires AMI Database connection details:
       export FM_SERVER='<server_ip>'
       export AMI_DATABASE='<database_name>'
       export AMI_DATABASE_USERNAME='<username>'
       export AMI_DATABASE_PASSWORD='<password>'
      
    • For fetch_and_export_fm_data.py, which requires FileMaker connection details for both production and development servers:
       export FM_SERVER='<server_ip>'
       export FM_DEV_SERVER='<dev_server_ip>'
       export FM_DATABASE='<database_name>'
       export FM_DATABASE_USERNAME='<username>'
       export FM_DATABASE_PASSWORD='<password>'
      
  4. Save and close TextEdit. After adding your variables, save the changes and close the editor.

  5. Apply the changes by typing the following in Terminal:
    source ~/.zshrc
    

    This command reloads your .zshrc, applying the new environmental settings.

Installing and Configuring Java (OpenJDK 11)

  1. Install OpenJDK 11 using Homebrew
    brew install openjdk@11
    
  2. Add OpenJDK 11 to your environment
      echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
      echo 'export JAVA_HOME="/usr/local/opt/openjdk@11"' >> ~/.zshrc
    
  3. Reload your .zshrc file
    source ~/.zshrc
    
  4. Verify the Java installation
    java -version
    
  5. Install the required jaydebeapi Python package

For the fetch_and_export_fm_data.py script to work, you need to install the jaydebeapi package for connecting to the FileMaker database through JDBC. You can install it using the following command:

   python3 -m pip install jaydebeapi
  1. Verify the installation by importing jaydebeapi in a Python script or running the following command:

    python3 -c "import jaydebeapi; print('jaydebeapi installed successfully!')"
    

Verification:

  • To verify that the environmental variables are set correctly, you can echo them in the Terminal. For example:
    echo $TRELLO_API_KEY
    

    This should display the value you set for the TRELLO_API_KEY variable.

Troubleshooting:

  • If changes to .zshrc do not seem to apply, make sure you have saved the file after editing and run source ~/.zshrc again.
  • If a script fails to recognize the variables, ensure that there are no typos in your .zshrc file and that all variable names are correct.

By setting up these variables as instructed, users will ensure smooth operation of scripts requiring specific configurations, supporting effective digitization and preservation workflows.