@@ -14,6 +14,7 @@ source "${SCRIPT_DIR}/lib.sh"
1414set -euo pipefail
1515
1616CODER_DEV_ACCESS_URL=" ${CODER_DEV_ACCESS_URL:- http:// 127.0.0.1: 3000} "
17+ DEVELOP_IN_CODER=" ${DEVELOP_IN_CODER:- 0} "
1718debug=0
1819DEFAULT_PASSWORD=" SomeSecurePassword!"
1920password=" ${CODER_DEV_ADMIN_PASSWORD:- ${DEFAULT_PASSWORD} } "
@@ -66,6 +67,10 @@ if [ "${CODER_BUILD_AGPL:-0}" -gt "0" ] && [ "${multi_org}" -gt "0" ]; then
6667 echo ' == ERROR: cannot use both multi-organizations and APGL build.' && exit 1
6768fi
6869
70+ if [ -n " ${CODER_AGENT_URL} " ]; then
71+ DEVELOP_IN_CODER=1
72+ fi
73+
6974# Preflight checks: ensure we have our required dependencies, and make sure nothing is listening on port 3000 or 8080
7075dependencies curl git go make pnpm
7176curl --fail http://127.0.0.1:3000 > /dev/null 2>&1 && echo ' == ERROR: something is listening on port 3000. Kill it and re-run this script.' && exit 1
@@ -75,7 +80,7 @@ curl --fail http://127.0.0.1:8080 >/dev/null 2>&1 && echo '== ERROR: something i
7580# node_modules if necessary.
7681GOOS=" $( go env GOOS) "
7782GOARCH=" $( go env GOARCH) "
78- make -j " build/coder_${GOOS} _${GOARCH} "
83+ DEVELOP_IN_CODER= " ${DEVELOP_IN_CODER} " make -j " build/coder_${GOOS} _${GOARCH} "
7984
8085# Use the coder dev shim so we don't overwrite the user's existing Coder config.
8186CODER_DEV_SHIM=" ${PROJECT_ROOT} /scripts/coder-dev.sh"
@@ -150,7 +155,7 @@ fatal() {
150155 trap ' fatal "Script encountered an error"' ERR
151156
152157 cdroot
153- DEBUG_DELVE=" ${debug} " start_cmd API " " " ${CODER_DEV_SHIM} " server --http-address 0.0.0.0:3000 --swagger-enable --access-url " ${CODER_DEV_ACCESS_URL} " --dangerous-allow-cors-requests=true --enable-terraform-debug-mode " $@ "
158+ DEBUG_DELVE=" ${debug} " DEVELOP_IN_CODER= " ${DEVELOP_IN_CODER} " start_cmd API " " " ${CODER_DEV_SHIM} " server --http-address 0.0.0.0:3000 --swagger-enable --access-url " ${CODER_DEV_ACCESS_URL} " --dangerous-allow-cors-requests=true --enable-terraform-debug-mode " $@ "
154159
155160 echo ' == Waiting for Coder to become ready'
156161 # Start the timeout in the background so interrupting this script
0 commit comments