-
Notifications
You must be signed in to change notification settings - Fork 0
/
env_variables.sh
executable file
·148 lines (125 loc) · 6.11 KB
/
env_variables.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# ENV_VARIABLES.sh
# Capture and print the current time:
export ENV_VAR_LOAD_DATE_TIME=$(date '+%Y-%m-%d %H:%M:%S')
export PGPORT=4999
#sync with the dashlane cli. This updates the secrets to be stored locally
dcli sync
#Get all the locally stored secrets
json_string=$(dcli note localeFormat=UNIVERSAL -o json)
echo "\033[1;34m > json_string with secrets \033[0;32m Successfully Obtained. \033[0m"
# echo "json_string is ${json_string}"
# Ensure 'jq' is available (JSON Parser)
if ! command -v jq &>/dev/null; then
echo "\033[0;31m !!! jq (JSON Parser) command could not be found. It is required to obtain the secrets.\033[0m"
exit
else
echo -e "\033[1;34m > jq (JSON Parser) command is: \033[3;32m ** Present **. \033[0m"
fi
SECRET_TITLES=""
# Loop through each entry in the JSON array
echo "$json_string" | jq -c '.[]' | while read -r i; do
# Extract title and content
title=$(echo "$i" | jq -r '.title')
content=$(echo "$i" | jq -r '.content')
# Export them as environment variables
export "${title}=${content}"
# Append to SECRET_TITLES
SECRET_TITLES="${SECRET_TITLES}\n${title}=${content}"
done
# Write SECRET_TITLES and all secrets to the .env file
echo -e "SECRET_TITLES=${SECRET_TITLES}" >"${HOME}/code/mytech/.env"
echo -e "SECRET_TITLES=${SECRET_TITLES}" >"${HOME}/code/mytech/docker/ListGen/flask/.env"
echo -e "SECRET_TITLES=${SECRET_TITLES}" >"${HOME}/code/mytech/docker/ListGen/streamlit/.env"
echo -e "SECRET_TITLES=${SECRET_TITLES}" >"${HOME}/.jbi/.env"
#Check if $SHOW_ME exists and is set to 123456. if so echo a green message else a red message
if [ -n "${SHOW_ME}" ] && [ "${SHOW_ME}" = "123456" ]; then
echo -e "\033[0;34m > The SHOW_ME value of 123456 is: \033[0;32m ** CORRECT ** \033[0m"
echo -e "\033[0;34m > Date/Time of Secrets load: \033[0;32m ** ${ENV_VAR_LOAD_DATE_TIME} ** \033[0m"
else
echo -e "\033[0;31m > The value of SHOW_ME is not 123456. It is ${SHOW_ME}. This is incorrect. \033[0m"
exit
fi
#Standardize python commands
alias python='python3'
alias pip='pip3'
#Key Folder Locations for python scripts and projects
export NVM_DIR=/opt/homebrew/Cellar/nvm/0.39.7
# PATH export (Standard mack path)
export PATH="/System/Cryptexes/App/usr/bin:/usr/bin:/bin" # Standard Path
export PATH="${PATH}:/usr/sbin:/sbin:/usr/local/bin" # Standard Path
# Add additional locations to the PATH
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" # Homebrew (prioritizing it over the system python)
export PATH="${PATH}:${HOME}/.jbi/scripts"
export PATH="${PATH}:${HOME}/.jbi/classes" # personal scripts
export PATH="${PATH}:${HOME}/.jbi/transcription"
export PATH="${PATH}:${HOME}/code/MyTech/classes" # personal scripts
export PATH="${PATH}:${HOME}/code/MyTech/docker/MyTech/streamlit" # personal scripts
export PATH="${PATH}:${HOME}/code/MyTech/docker/ListGen/streamlit" # personal scripts
export PATH="${PATH}:${HOME}/.jbi/classes" # personal scripts
export PATH="${PATH}:${HOME}/.jbi/classes" # personal scripts
export PATH="${PATH}:/Applications/geckodriver*" # For Scraping
export PATH="${PATH}:/opt/homebrew/bin/jupyter-lab" # For Jupiter Lab
# Personal custom classes
export PYTHONPATH="${HOME}/.jbi/classes"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_streamlit.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_extract_text.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_ollama.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_BMM.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_storage.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_dow_jones.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_pe_categorize_transactions.py"
export PYTHONPATH="${PYTHONPATH}:${HOME}/.jbi/classes/_class_search_web.py"
# Set the default editor to Visual Studio Code
export EDITOR="code"
# export LOG_LEVEL="LIGHT" # "Used to trigger heavier logging and print statements for debugging options are: LIGHT or VERBOSE"
#Streamlit
export STREAMLIT_SERVER_MAX_UPLOAD_SIZE=10000
# OpenAI
export OPENAI_TRANSCRIPTION_ENDPOINT="https://api.openai.com/v1/transcriptions"
# Azure
# export AZURE_DEVOPS_ORG="justbuildit" # "Azure DevOps"
# export AZURE_PROJECT_NAME="OC2Communify" # "Azure DevOps"
# export AZURE_PROJECT_BASE_URL="https://${AZURE_DEVOPS_ORG}@dev.azure.com/${AZURE_DEVOPS_ORG}/${AZURE_PROJECT_NAME}/_git" # "Azure DevOps"
# export AZURE_AUTH_HEADER="Authorization: Basic $(echo -n justbuildit.com:${AZURE_DEVOPS_PAT})" # "Azure DevOps"
# export AZURE_PROJECTS_ENDPOINT="https://dev.azure.com/${AZURE_DEVOPS_ORG}/_apis/projects?api-version=6.0" # "Azure DevOps"
##### NGROK#####
# Get the ngrok public URL
# Make the curl request and use jq to parse the JSON response, extracting the public_url
NGROK_PUBLIC_URL=$(curl -s \
-X GET \
-H "Authorization: Bearer ${NGROK_API_KEY}" \
-H "Ngrok-Version: 2" \
"https://api.ngrok.com/endpoints" | jq -r '.endpoints[0].public_url')
# Export the public URL as an environment variable
echo "Extracted Public URL: $NGROK_PUBLIC_URL"
export NGROK_PUBLIC_URL
# Now, NGROK_PUBLIC_URL is available as an environment variable in this script's execution context
# To use it in other terminal sessions or scripts, you might need to source this script or handle it differently
#Color Variables for text
BLACK='\033[0;30m'
RED='\033[0;31m'
RED_U='\033[4;31m'
RED_BLINK='\033[5;31m'
GREEN='\033[0;32m'
GREEN_BLINK='\033[5;32m'
YELLOW='\033[0;33m'
YELLOW_BOLD='\033[1;33m'
PURPLE='\033[1;34m'
PURPLE_U='\033[4;34m'
PURPLE_BLINK='\033[5;34m'
PINK='\033[0;35m'
PINK_U='\033[4;35m'
PINK_BLINK='\033[5;35m'
LIGHTBLUE='\033[0;36m'
LIGHTBLUE_BOLD='\033[1;36m'
GRAY='\033[0;37m'
ORANGE='\033[1;91m'
BLUE='\033[1;94m'
CYAN='\033[1;96m'
WHITE='\033[1;97m'
MAGENTA='\033[1;95m'
BOLD='\033[1m'
UNDERLINE='\033[4m'
BLINK='\033[5m'
NC='\033[0m' # No Color