<commit_before># Modify config file with hostname
host=$(hostname)
sed "s:@SERVER_NAME@:${host}:g" /opt/imgapi/etc/imgapi.config.tpl > \
	/opt/imgapi/etc/imgapi.config.json

# Enable imgapi
svcadm enable svc:/smartdc/site/imgapi<commit_msg>generate users and allow mdata info users<commit_after># Create authentication defaults
IMGAPI_ADMIN=${IMGAPI_ADMIN:-$(mdata-get imgapi_admin 2>/dev/null)} || \
	IMGAPI_ADMIN=$(od -An -N8 -x /dev/random | head -1 | tr -d ' ');
mdata-put imgapi_admin ${IMGAPI_ADMIN}

# Create authentication for users based on mdata
if mdata-get imgapi_users 1>/dev/null 2>&1; then
	for list in $(mdata-get imgapi_users); do
		u=$(echo ${line} | awk -F \: '{ print $1 }')
		p=$(echo ${line} | awk -F \: '{ print $2 }')

		USERS="\"${u}\": \"${p}\",\n${USERS}"
	done
fi

USERS="${USERS}\n\"admin\": \"${IMGAPI_ADMIN}\""

# Modify config file with hostname and users
host=$(hostname)
sed -e "s:@SERVER_NAME@:${host}:g" \
	-e "s:@AUTH_USERS@:${USERS}:g" \
	/opt/imgapi/etc/imgapi.config.tpl > \
	/opt/imgapi/etc/imgapi.config.json

# Enable imgapi
svcadm enable svc:/smartdc/site/imgapi
{'fraction_non_alphanumeric': 0.19168173598553345, 'fraction_numerical': 0.007233273056057866, 'mean_word_length': 4.3478260869565215, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '397269', 'n_tokens_mistral': 449, 'n_tokens_neox': 439, 'n_words': 97}