Skip to content

Commit

Permalink
Update for enfist v0.6.11
Browse files Browse the repository at this point in the history
  • Loading branch information
LeKovr committed Sep 24, 2022
1 parent 21c2184 commit 7dfd458
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CFG = .env
CIS_TOKEN ?= set_from_cis_site_data

# Config store url
ENFIST_URL ?= http://cis.dev.lan/conf/rpc
ENFIST_URL ?= http://cis.dev.lan/conf/api

-include $(CFG)
export
Expand All @@ -21,21 +21,21 @@ all: help
## get env tag list store, `make ls`
ls:
@echo -e "** Configs at server $${ENFIST_URL}:\n" ; \
curl -gs -b "narra_token=$$CIS_TOKEN" "$${ENFIST_URL}/tag" | jq -r '.[].code'
curl -gs -H "X-narra-token:$$CIS_TOKEN" "$${ENFIST_URL}/tag/" | jq -r '.[].code'

## cat data of env tag from store, `make cat TAG=app--config--tag[.env]`
cat:
@[[ "$(TAG)" ]] || { echo "Error: Tag value required" ; exit 1 ;}
@echo "Getting env into $(TAG)" \
&& tag=$${TAG%.env} \
&& curl -gs -b "narra_token=$$CIS_TOKEN" "$${ENFIST_URL}/tag_vars?code=$$tag" | jq -r '.'
&& curl -gs -H "X-narra-token:$$CIS_TOKEN" "$${ENFIST_URL}/tag_vars/?code=$$tag" | jq -r '.'

## get env tag from store, `make get TAG=app--config--tag[.env]`
get:
@[[ "$(TAG)" ]] || { echo "Error: Tag value required" ; exit 1 ;}
@echo "Getting env into $(TAG)" \
&& tag=$${TAG%.env} \
&& curl -gs -b "narra_token=$$CIS_TOKEN" "$${ENFIST_URL}/tag_vars?code=$$tag" \
&& curl -gs -H "X-narra-token:$$CIS_TOKEN" "$${ENFIST_URL}/tag_vars/?code=$$tag" \
| jq -r '.' > $${tag}.env

## set env tag in store, `make set TAG=app--config--tag[.env]`
Expand All @@ -44,19 +44,20 @@ set:
@echo "Setting $(TAG) from file" \
&& tag=$${TAG%.env} \
&& jq -R -sc ". | {\"code\":\"$$tag\",\"data\":.}" < $${tag}.env \
| curl -gsd @- -b "narra_token=$$CIS_TOKEN" "$${ENFIST_URL}/tag_set" | jq '.'
| curl -gsd @- -H "X-narra-token:$$CIS_TOKEN" "$${ENFIST_URL}/tag_set/" | jq '.'

## del env tag from store, `make del TAG=app--config--tag[.env]`
del:
@[[ "$(TAG)" ]] || { echo "Error: Tag value required" ; exit 1 ;}
@echo "Deleting $(TAG)" \
&& tag=$${TAG%.env} \
&& curl -gs -b "narra_token=$$CIS_TOKEN" "$${ENFIST_URL}/tag_del?code=$$tag" | jq '.'
&& curl -gs -H "X-narra-token:$$CIS_TOKEN" "$${ENFIST_URL}/tag_del/?code=$$tag" | jq '.'

define CONFIG_DEF
# dcape-app-config config file, generated by make init

# CIS access token
# from gitea's /user/settings/applications
CIS_TOKEN=$(CIS_TOKEN)

# Config store url
Expand Down

0 comments on commit 7dfd458

Please sign in to comment.