Move .env into skills/ for easy install

- Added skills/_env_loader.py - shared env loader for all scripts
- Updated 17 scripts to use load_unified_env()
- Updated install-skills.sh to copy .env into skills/
- Updated README with simpler OpenClaw install instructions
- .env in skills/ is gitignored (credentials stay private)
This commit is contained in:
Kunthawat Greethong
2026-03-27 17:49:20 +07:00
parent 4e92ef953b
commit e4d41e3ae5
20 changed files with 219 additions and 212 deletions

View File

@@ -151,10 +151,11 @@ setup_unified_env() {
fi
}
# Copy unified .env to global location
# Copy unified .env to global location and into skills/
copy_unified_env() {
local source_env="${REPO_ROOT}/.env"
local target_env="${GLOBAL_DIR}/.env"
local skills_env="${SKILLS_DIR}/.env"
if [ -f "$source_env" ]; then
print_info "Copying unified .env to global location..."
@@ -162,6 +163,11 @@ copy_unified_env() {
cp "$source_env" "$target_env"
chmod 600 "$target_env"
print_success "Created: ${target_env}"
print_info "Copying .env into skills/ folder..."
cp "$source_env" "$skills_env"
chmod 600 "$skills_env"
print_success "Created: ${skills_env}"
echo ""
fi
}
@@ -266,26 +272,7 @@ main() {
copy_unified_env
# Create skill-specific .env files that reference unified .env
print_info "Creating skill configuration files..."
for skill in $SKILLS; do
dest="${TARGET}/${skill}"
scripts_dir="${dest}/scripts"
[ -d "$scripts_dir" ] || continue
# Create .env file that tells script where to find unified .env
cat > "${scripts_dir}/.env" << EOF
# AUTO-GENERATED - DO NOT EDIT
# This skill uses the unified .env file
# Location: ${GLOBAL_DIR}/.env
#
# Edit that file instead to update credentials.
# This file is overwritten on each install.
EOF
chmod 600 "${scripts_dir}/.env"
done
# (No longer needed - .env is in skills/ folder)
print_success "All skills configured"
echo ""