Make ENV vars optional for multi-tenant usage#9
Merged
Conversation
Implements Option A from issue #7: Make ENV vars optional in global config and emphasize per-instance credential passing for multi-tenant applications. Changes: - Updated README Quick Start to recommend per-instance credentials - Made global configuration explicitly optional - Moved and enhanced Multi-Tenant Usage section with database storage example - Updated Configuration Options to show instance config first (recommended) - Updated spec_helper to make ENV vars optional (only used for VCR filtering) - All tests passing without requiring ENV vars This change supports the recommended pattern for multi-tenant applications where OAuth credentials are stored in the database and passed per-instance, eliminating the need for environment variables. Closes #7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Option A from #7: Make ENV vars optional in global config and emphasize per-instance credential passing for multi-tenant applications.
Problem
The gem appeared to require
NATIONBUILDER_CLIENT_IDandNATIONBUILDER_CLIENT_SECRETenvironment variables, but this was only due to the global configuration pattern shown in examples. The gem already supports passing credentials per-instance, which is the preferred pattern for multi-tenant applications.Solution
This PR clarifies the documentation to show that:
Client.newChanges
Documentation Updates (README.md)
Test Updates (spec/spec_helper.rb)
Benefits
✅ No ENV variables required - Credentials passed per-instance
✅ Better multi-tenant support - Store OAuth credentials in database
✅ Flexible configuration - Mix global defaults with per-instance overrides
✅ Cleaner architecture - Credentials in database, not environment
✅ All tests passing - 92.51% coverage, no ENV vars needed
Example Usage
Before (appeared to require ENV vars)
After (per-instance credentials, no ENV vars needed)
Closes #7