mle-tools-configuration
v1.0.15
Published
A configuration management tool for TypeScript/JavaScript applications
Maintainers
Readme
mle-tools-configuration
A configuration management tool for TypeScript/JavaScript applications
🚀 Features
- 🔧 Type-safe configuration management
- 🔄 Dynamic configuration updates
- 🎯 Domain-based configuration organization
- 🛠 JSON-based configuration storage
- 📦 Easy integration with existing projects
- 🔍 Comprehensive documentation with Memory Bank
📦 Installation
npm install mle-tools-configuration🎯 Quick Start
import { Configuration, configurationFactory } from 'mle-tools-configuration';
// Set up initial configuration
configurationFactory.setUp(
[{ key: 'database', value: { host: 'localhost', port: 5432 } }],
[{ domain: 'app', keys: ['database'] }]
);
// Get configuration instance
const config = configurationFactory.getConfiguration();
// Access configuration values
const dbConfig = config.getSubConf('database');
console.log(dbConfig); // { host: 'localhost', port: 5432 }
// Merge new configuration
config.merge({
database: { username: 'admin' }
});📚 Documentation
Memory Bank
This project uses a Memory Bank for comprehensive documentation and context retention. The Memory Bank is located in the .memory-bank directory and contains the following files:
memory-bank-rules.md: Rules to follow and to consider in all contextsprojectbrief.md: Overview of the project, core requirements, and goalsproductContext.md: Why the project exists, problems it solves, and how it workssystemPatterns.md: System architecture, key technical decisions, and design patternstechContext.md: Technologies used, development setup, and technical constraintsactiveContext.md: Current work focus, recent changes, and next stepsprogress.md: What works, what's left to build, and known issues
=> !! These files should always be considered as a context and keep up-to-date !!
🔧 API Reference
Configuration Class
getJSON(domain?): Get the entire configuration as a JSON stringgetSubJSON(key): Get a specific configuration section as a JSON stringgetConf(domain?): Get the configuration objectgetSubConf(key): Get a specific configuration sectioncontains(configurationAsString): Check if configuration contains the specified configurationmerge(conf): Merge new configurationset(key, value): Set a specific configuration valueadd(key, value): Add to existing configurationupdate(factory): Update the configuration factory
ConfigurationFactory
setUp(configs, domains): Initialize the configuration factorygetConfiguration(override?): Get a configuration instance
🧪 Testing
npm test📝 Changelog
See CHANGELOG.md for a detailed list of changes.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
🙏 Acknowledgments
- Built with TypeScript
- Tested with Mocha and Chai
- Coverage with NYC
