This document provides an overview of the features and configurations set in the bash.rc
file. This file is used to customize the shell environment, set up environment variables, and define functions and aliases for ease of use.
- PROMPT_COMMAND: Customizes the shell prompt to display memory usage and system load averages.
- PS1: Sets the primary prompt string to include process IDs, job count, command history number, time, date, user, host, and working directory.
- ENV_FILE: Specifies the path to the environment file (
/workdir/.env
).
- SW_TEST_URL: Constructs a URL for testing SignalWire credentials.
- response_code: Captures the HTTP response code from the SignalWire API to verify credentials.
- Checks the response code from the SignalWire API:
200
: Credentials are valid.404
: SignalWire space not found; deletes the.env
file.401
: Invalid credentials; deletes the.env
file.- Other: Indicates incomplete setup; deletes the
.env
file.
- Prompts the user for SignalWire and NGROK credentials if the
.env
file is missing. - Uses
whiptail
to collect user inputs for various credentials and settings. - Writes collected inputs to the
.env
file and sources it.
- Starts an NGROK tunnel if the NGROK token is provided.
- Retrieves and exports the public URL of the NGROK tunnel.
- Displays a welcome message and NGROK tunnel information if available.
- Sources additional configuration files if they exist in
/workdir
. - Creates symbolic links for configuration files like
.emacs
,.gitconfig
,.pypirc
, and.ssh
. - Executes a PostgreSQL setup script if available.
- /usr/bin/setuppgsql: Moves the PostgreSQL database to
/workdir
to ensure data persistence and proper configuration.
- Copies GitHub Copilot configuration to the user's config directory if present.
- Installs Perl dependencies specified in
cpanfile
and updates thePATH
andPERL5LIB
.
- Defines common typos for
emacs
to ensure the correct command is executed. - Defines an alias
ngrok_url
to fetch the current NGROK public URL.
- Sets up the environment for NVM if the script is available.
- Updates the
PATH
for Go binaries if Go is installed.
- Sets the default visual editor to
vim
if not already set.
- Extends the
PATH
to include directories for Node.js, Perl, and Python binaries.
- Executes a SignalWire shell script if all necessary credentials are available and a specific file is not present.
- Overrides the default
cd
command to automatically activate or deactivate Python virtual environments based on the presence of avenv
directory.
- Manages Python virtual environments:
init
: Creates or activates a virtual environment in the current directory.delete
: Deletes the virtual environment if it exists.
- Runs
app.py
in an infinite loop, restarting it after a 1-second delay if it exits.