Skip to content

Conversation

@mehmetyavuzz43
Copy link

@mehmetyavuzz43 mehmetyavuzz43 commented Dec 22, 2025

Provides a .env sanity-check script that validates required variables for Polymarket Agents.


Note

Introduces a minimal .env validator to catch missing required configuration early.

  • Adds scripts/bash/check_env.sh that checks for .env, parses and exports non-comment entries, and verifies POLYGON_WALLET_PRIVATE_KEY and OPENAI_API_KEY
  • Emits clear error messages and non-zero exit on missing/empty vars; prints success when all required vars are present

Written by Cursor Bugbot for commit da45db1. This will update automatically on new commits. Configure here.

Provides a .env sanity-check script that validates required variables for Polymarket Agents.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to Polymarket Agents. Thank you for creating your first PR. Cheers!

continue
;;
*)
export "${key}=${value}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoted values pass validation despite being empty

The .env.example template uses quoted empty values like KEY="". When the script parses these, the literal quote characters become part of the value, so "" is treated as a 2-character non-empty string. This causes the -z check to pass when it shouldn't. If a user copies .env.example to .env without filling in values, the script incorrectly reports all required variables as present, defeating the purpose of the sanity check.

Additional Locations (1)

Fix in Cursor Fix in Web

continue
;;
*)
export "${key}=${value}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell expansion corrupts values containing dollar signs

The export "${key}=${value}" statement uses double quotes, causing shell variable expansion and command substitution in values. If an API key contains $ characters (e.g., mykey$123), the $123 portion will be expanded as a shell variable (likely empty), corrupting the value. This could cause the validation to incorrectly fail for legitimate credentials or produce misleading results.

Fix in Cursor Fix in Web

export "${key}=${value}"
;;
esac
done < "${ENV_FILE}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last line skipped if file lacks trailing newline

The while IFS='=' read -r key value loop silently drops the last line of the .env file if it doesn't end with a trailing newline. The read command returns non-zero at EOF even when it successfully reads data, causing the loop to exit before processing. If a required variable is on the final line of such a file, validation would incorrectly fail. The standard fix is while read ... || [ -n "$key" ].

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant