-
-
Notifications
You must be signed in to change notification settings - Fork 176
chore(docker): openemr-cmd up prompt for gh token #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
c96c8d6
9886b97
187f708
d036069
6702b48
57328ad
cf0e6c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,7 @@ set -euo pipefail | |||||||
| ################################################################################################# | ||||||||
|
|
||||||||
| # Increment the version when modify script | ||||||||
| VERSION="1.0.25" | ||||||||
| VERSION="1.0.26" | ||||||||
| # If the docker is snap or non-snap docker | ||||||||
| # Setting the container names accordingly | ||||||||
| get_container_names() { | ||||||||
|
|
@@ -366,6 +366,89 @@ docker-pull-image(){ | |||||||
| done <<< "${services}" | ||||||||
| } | ||||||||
|
|
||||||||
| # Walk the developer through creating/updating the .env file for the easydev | ||||||||
| # docker-compose environment, so that secrets like GITHUB_COMPOSER_TOKEN are | ||||||||
| # never committed to the repository in plaintext. | ||||||||
| setup_composer_env() { | ||||||||
| local ENV_FILE | ||||||||
|
|
||||||||
| if [[ ! -f "docker-compose.yml" ]]; then | ||||||||
| echo "Error: docker-compose.yml not found in current directory." >&2 | ||||||||
| echo "Please run this command from the docker/development-easy directory." >&2 | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| ENV_FILE="../../.env" | ||||||||
|
|
||||||||
| echo "" | ||||||||
| echo "=== OpenEMR Easydev Composer Token Setup ===" | ||||||||
| echo "" | ||||||||
| echo "A GitHub Personal Access Token lets Composer avoid GitHub API rate limits" | ||||||||
| echo "when pulling dependencies. It should never be committed to the repository." | ||||||||
| echo "This writes GITHUB_COMPOSER_TOKEN plus its derived encoded variants to: ${ENV_FILE}" | ||||||||
|
||||||||
| echo "This writes GITHUB_COMPOSER_TOKEN plus its derived encoded variants to: ${ENV_FILE}" | |
| echo "This writes GITHUB_COMPOSER_TOKEN to: ${ENV_FILE}" |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompt reads the PAT with normal read, which echoes the token to the terminal and stores it in scrollback/history for many shells. Use silent input (eg, read -s) and consider disabling readline (-e) for secret entry.
| read -r -e -p "Paste your GitHub Personal Access Token: " TOKEN </dev/tty | |
| read -r -s -p "Paste your GitHub Personal Access Token: " TOKEN </dev/tty | |
| echo "" |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message claims the root .gitignore covers .env, but the repo’s .gitignore currently does not ignore .env. Since this command creates/updates ../../.env with a PAT, this is a real risk of accidentally committing credentials. Either update the repo ignore rules / use a file that’s already ignored, or change the guidance and default path.
| echo " (.env is covered by the root .gitignore)" | |
| echo " WARNING: ${ENV_FILE} is not ignored by git by default. Add it to .gitignore to avoid committing credentials." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added .env to the .gitignore here in this repo even though it applies when running in openemr
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With set -euo pipefail, this command substitution will cause openemr-cmd up to exit immediately if curl fails (offline), GitHub is unreachable, or grep finds no match. Wrap the curl/parse pipeline in || true (or temporarily disable errexit) and handle an empty/failed response explicitly so up still proceeds or falls back to setup_composer_env. Also note the PAT is passed on the curl command line (visible via process listings); consider avoiding this validity check or using a safer mechanism.
| https://api.github.com/rate_limit | grep -o '"remaining":[0-9]*' | head -1 | cut -d: -f2) | |
| https://api.github.com/rate_limit | grep -o '"remaining":[0-9]*' | head -1 | cut -d: -f2 || true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this also be other directories? (insane one, predis one)