Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ import { promisify } from 'util';

export const ROOT_PATH = join(__dirname, '../..');
export const DFX_PATH = join(ROOT_PATH, 'dfx.json');
export const DFX_DEFAULT_IDENTITY_STORE_PATH = join(homedir(), '.config/dfx/identity');
// DFX_CONFIG_ROOT stands in for the home directory, the same way dfx itself
// treats it. Without this a caller that isolates the identity store has to
// repoint HOME as well, which hides the dfxvm version store and makes dfx
// report the pinned version as not installed.
export const DFX_DEFAULT_IDENTITY_STORE_PATH = join(
process.env.DFX_CONFIG_ROOT || homedir(),
'.config/dfx/identity',
);

// Parse a string of arguments separated by a separator and return an array of strings.
export const parseArgsListSplitByComma = (arg?: string): string[] => {
Expand Down
10 changes: 5 additions & 5 deletions scripts/deploy-backend
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ if [[ -n "$DRY" ]]; then echo "dry run: artifacts verified, nothing shipped."; e

# 2. Load the key into a throwaway dfx home.
#
# HOME and DFX_CONFIG_ROOT both have to point at it: dfx honours
# DFX_CONFIG_ROOT, but orbit-cli resolves the pem from homedir() directly. Set
# only one and `registry publish` cannot find the identity dfx just imported.
# Doing this after the downloads keeps the real HOME in place for gh.
# DFX_CONFIG_ROOT only, never HOME. dfx is usually a dfxvm shim that resolves
# the version pinned in dfx.json under $HOME, so repointing HOME hides the
# installed toolchain and dfx exits with "0.30.2 is not installed". Both dfx
# and orbit-cli read the identity store from DFX_CONFIG_ROOT.
if [[ -n "$OP_REF" ]]; then
command -v op >/dev/null || die "1Password CLI (op) not found"
echo "==> reading key from 1Password"
Expand All @@ -186,7 +186,7 @@ if [[ -n "$OP_REF" ]]; then
fi

DFX_HOME="$(mktemp -d)"; chmod 700 "$DFX_HOME"
export HOME="$DFX_HOME" DFX_CONFIG_ROOT="$DFX_HOME"
export DFX_CONFIG_ROOT="$DFX_HOME"
dfx identity import "$IDENTITY" "$PEM" --storage-mode plaintext --force

# Every network in dfx.json other than local points at mainnet, and dfx refuses
Expand Down
Loading