Skip to content

Commit

Permalink
fix(_run): ensure AKASH_HOME is set either by make or direnv (akash-n…
Browse files Browse the repository at this point in the history
…etwork#111)

throw error if direnv is missing and AKASH_HOME is set

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Apr 18, 2023
1 parent 598ff14 commit fffdc43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 12 additions & 2 deletions _run/common-base.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
include $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../make/init.mk)
include $(abspath $(CURDIR)/../../make/init.mk)

AP_RUN_NAME := $(notdir $(CURDIR))
AP_RUN_DIR := $(DEVCACHE_RUN)/$(AP_RUN_NAME)
AKASH_HOME ?= $(DEVCACHE_RUN)/$(AP_RUN_NAME)/.akash

ifneq ($(AKASH_HOME),)
ifneq ($(DIRENV_FILE),$(CURDIR)/.envrc)
$(error "AKASH_HOME is set by the upper dir (probably in ~/.bashrc|~/.zshrc), \
but direnv does not seem to be configured. \
Ensure direnv is installed and hooked to your shell profile. Refer to the documentation for details. \
")
endif
else
export AKASH_HOME = $(DEVCACHE_RUN)/$(AP_RUN_NAME)/.akash
endif

.PHONY: bins
bins:
Expand Down
4 changes: 0 additions & 4 deletions _run/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ comma := ,

SKIP_BUILD ?= false

ifndef AKASH_HOME
$(error AKASH_HOME is not set)
endif

export AKASH_KEYRING_BACKEND = test
export AKASH_GAS_ADJUSTMENT = 2
export AKASH_CHAIN_ID = local
Expand Down

0 comments on commit fffdc43

Please sign in to comment.