Skip to content

chore(scripts/develop.sh): add license from env var if provided #19374

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scripts/develop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ source "${SCRIPT_DIR}/lib.sh"
set -euo pipefail

CODER_DEV_ACCESS_URL="${CODER_DEV_ACCESS_URL:-http://127.0.0.1:3000}"
CODER_DEV_LICENSE="${CODER_DEV_LICENSE:-""}"
DEVELOP_IN_CODER="${DEVELOP_IN_CODER:-0}"
debug=0
DEFAULT_PASSWORD="SomeSecurePassword!"
Expand Down Expand Up @@ -200,6 +201,18 @@ fatal() {
echo 'Failed to create regular user. To troubleshoot, try running this command manually.'
fi

# Add a license if one is provided and we are not operating in AGPL mode.
if [ "${CODER_BUILD_AGPL:-0}" -gt "0" ]; then
if [ -n "${CODER_DEV_LICENSE}" ]; then
NUM_LICENSES=$("${CODER_DEV_SHIM}" licenses list -o json | jq -r '. | length')
if [ "${NUM_LICENSES}" -eq "0" ]; then
echo -n "${CODER_DEV_LICENSE}" | "${CODER_DEV_SHIM}" licenses add -f - || echo "ERROR: failed to add license. Try adding one manually."
else
echo "At least one license already exists."
fi
fi
fi

# Create a new organization and add the member user to it.
if [ "${multi_org}" -gt "0" ]; then
another_org="second-organization"
Expand Down
Loading