Skip to content

feat: don't require .env to exist#427

Merged
jkbrooks merged 2 commits into
elizaOS:mainfrom
odilitime:env-change
Nov 20, 2024
Merged

feat: don't require .env to exist#427
jkbrooks merged 2 commits into
elizaOS:mainfrom
odilitime:env-change

Conversation

@odilitime
Copy link
Copy Markdown
Collaborator

Risks

Medium, haven't discussed this widely

Background

What does this PR do?

Removes the requirement for .env to exists

What kind of change is this?

Improvement

Why are we doing this? Any context or related work?

Large multiagent instances will have to rely on character.json to have all the settings and secrets for that agent. Have a default .env in these instances to set defaults might be helpful but also hurtful. This allows the admin to choose if they want any defaults across all their agents or nots.

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Ran against stable-11-17 branch without issue

@odilitime odilitime changed the title don't require .env to exist ux: don't require .env to exist Nov 20, 2024
// Load the .env file
const result = config({ path: envPath });
// attempt to Load the .env file into process.env
const result = config(envPath ? { path: envPath } : {});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirming that config({}) doesn't cause any errors?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It does not, I checked

@mcp97
Copy link
Copy Markdown
Contributor

mcp97 commented Nov 20, 2024

FYI: There is another approach to agent specific envs added in: #410 still via env but in a segmented way.

@odilitime
Copy link
Copy Markdown
Collaborator Author

I saw that, complementary to this. Wasn't sure if that's going to get merged so left it out of this description

@mcp97
Copy link
Copy Markdown
Contributor

mcp97 commented Nov 20, 2024 via email

@mcp97
Copy link
Copy Markdown
Contributor

mcp97 commented Nov 20, 2024

Looks like the limitations are: feat|fix|docs|style|refactor|test|chore:any description see

if [[ ! "$PR_TITLE" =~ ^(feat|fix|docs|style|refactor|test|chore):\ .+ ]]; then
                   echo "PR title does not match the required pattern."
                   exit 1
                 fi

@odilitime odilitime changed the title ux: don't require .env to exist feat: don't require .env to exist Nov 20, 2024
@mcp97
Copy link
Copy Markdown
Contributor

mcp97 commented Nov 20, 2024

LGTM! 🥇

@jkbrooks jkbrooks merged commit 9a0e474 into elizaOS:main Nov 20, 2024
lalalune pushed a commit that referenced this pull request May 3, 2026
feat: don't require .env to exist
FranceFlapjack pushed a commit to FranceFlapjack/eliza that referenced this pull request May 16, 2026
feat: don't require .env to exist
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.

3 participants