Skip to content

Commit 4b33861

Browse files
committed
testing
1 parent 6c86d8c commit 4b33861

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

codersdk/client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ import (
2929
// These cookies are Coder-specific. If a new one is added or changed, the name
3030
// shouldn't be likely to conflict with any user-application set cookies.
3131
// Be sure to strip additional cookies in httpapi.StripCoderCookies!
32+
// SessionTokenCookie represents the name of the cookie or query parameter the API key is stored in.
33+
// NOTE: This is declared as a var so that we can override it in `develop.sh` if required.
34+
var SessionTokenCookie = "coder_session_token"
35+
3236
const (
33-
// SessionTokenCookie represents the name of the cookie or query parameter the API key is stored in.
34-
SessionTokenCookie = "coder_session_token"
3537
// SessionTokenHeader is the custom header to use for authentication.
3638
SessionTokenHeader = "Coder-Session-Token"
3739
// OAuth2StateCookie is the name of the cookie that stores the oauth2 state.

scripts/build_go.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ boringcrypto=${CODER_BUILD_BORINGCRYPTO:-0}
4949
dylib=0
5050
windows_resources="${CODER_WINDOWS_RESOURCES:-0}"
5151
debug=0
52+
develop_in_coder="${DEVELOP_IN_CODER:-0}"
5253

5354
bin_ident="com.coder.cli"
5455

@@ -149,6 +150,13 @@ if [[ "$debug" == 0 ]]; then
149150
ldflags+=(-s -w)
150151
fi
151152

153+
if [[ "$develop_in_coder" == 1 ]]; then
154+
echo "INFO : Overriding codersdk.SessionTokenCookie as we are developing inside a Coder workspace."
155+
ldflags+=(
156+
-X "'github.com/coder/coder/v2/codersdk.SessionTokenCookie=dev_coder_session_token'"
157+
)
158+
fi
159+
152160
# We use ts_omit_aws here because on Linux it prevents Tailscale from importing
153161
# github.com/aws/aws-sdk-go-v2/aws, which adds 7 MB to the binary.
154162
TS_EXTRA_SMALL="ts_omit_aws,ts_omit_bird,ts_omit_tap,ts_omit_kube"

scripts/coder-dev.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ source "${SCRIPT_DIR}/lib.sh"
1010

1111
GOOS="$(go env GOOS)"
1212
GOARCH="$(go env GOARCH)"
13+
CODER_AGENT_URL="${CODER_AGENT_URL:-}"
14+
DEVELOP_IN_CODER=0
1315
DEBUG_DELVE="${DEBUG_DELVE:-0}"
1416
BINARY_TYPE=coder-slim
1517
if [[ ${1:-} == server ]]; then
@@ -35,16 +37,20 @@ CODER_DEV_DIR="$(realpath ./.coderv2)"
3537
CODER_DELVE_DEBUG_BIN=$(realpath "./build/coder_debug_${GOOS}_${GOARCH}")
3638
popd
3739

40+
if [[ ! -z "${CODER_AGENT_URL}" ]]; then
41+
DEVELOP_IN_CODER=1
42+
fi
43+
3844
case $BINARY_TYPE in
3945
coder-slim)
4046
# Ensure the coder slim binary is always up-to-date with local
4147
# changes, this simplifies usage of this script for development.
4248
# NOTE: we send all output of `make` to /dev/null so that we do not break
4349
# scripts that read the output of this command.
4450
if [[ -t 1 ]]; then
45-
make -j "${RELATIVE_BINARY_PATH}"
51+
DEVELOP_IN_CODER="${DEVELOP_IN_CODER}" make -j "${RELATIVE_BINARY_PATH}"
4652
else
47-
make -j "${RELATIVE_BINARY_PATH}" >/dev/null 2>&1
53+
DEVELOP_IN_CODER="${DEVELOP_IN_CODER}" make -j "${RELATIVE_BINARY_PATH}" >/dev/null 2>&1
4854
fi
4955
;;
5056
coder)

scripts/develop.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ source "${SCRIPT_DIR}/lib.sh"
1414
set -euo pipefail
1515

1616
CODER_DEV_ACCESS_URL="${CODER_DEV_ACCESS_URL:-http://127.0.0.1:3000}"
17-
CODER_DEV_SESSION_TOKEN_COOKIE_PREFIX="${CODER_DEV_SESSION_TOKEN_COOKIE_PREFIX:-dev}"
1817
debug=0
1918
DEFAULT_PASSWORD="SomeSecurePassword!"
2019
password="${CODER_DEV_ADMIN_PASSWORD:-${DEFAULT_PASSWORD}}"

site/src/api/typesGenerated.ts

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)