News KrakenD Enterprise v2.6 released with OpenTelemetry, FIPS-140, gRPC server and more

Optimize you API Gateway Management with Flexible Configuration

by Albert Garcia

May 14, 2023

2 min read

Flexible Configuration is a template-based configuration system for KrakenD API Gateway that allows you to manage configurations efficiently and cater to multiple environments. In this blog post, we’ll explore the pain-points it addresses and the benefits it brings to customers.

Flexible Configuration

Challenges solved by Flexible Configuration

Organizing and managing configurations can be challenging, especially when:

  • Configurations are extensive and need to be split into multiple files
  • You need to inject environment-specific variables
  • Reusable code blocks and placeholders are necessary to avoid repetition
  • Multiple developers are working on the API gateway
  • KrakenD is managed using multiple repositories
  • Tracking changes, avoiding conflicts, and reviewing code is crucial

Flexible Configuration is designed to tackle these pain-points effectively.

Key Benefits of Flexible Configuration

Flexible Configuration offers several advantages:

  1. Multi-Environment Configurations: Manage configurations for different environments like development, staging, and production with ease.
  2. Code Reuse: Use placeholders and reusable code blocks to avoid repetition and maintain consistency.
  3. Better Code Organization: Collaborate effectively with multiple developers and keep your codebase organized.
  4. Easier Version Control: Track changes, avoid conflicts, and review code more efficiently.
  5. Template System: Leverage the full power of a template system based on Go templates, Sprig functions, and KrakenD functions.

How to Use Flexible Configuration with KrakenD API Gateway

To activate Flexible Configuration, inject the environment variable FC_ENABLE=1 when running a krakend run or check command. You can then use additional variables depending on the features you’d like to enable.

Here are the recognized environment variables:

  • FC_ENABLE=1: Activates Flexible Configuration
  • FC_TEMPLATES=path/to/templates: Path to the templates directory
  • FC_SETTINGS=path/to/settings: Path to the settings directory
  • FC_PARTIALS=path/to/partials: Path to the partials directory
  • FC_OUT=file.json: Saves the resulting configuration after rendering the template

Conclusion

Flexible Configuration is a powerful solution to overcome common pain-points when managing configurations for KrakenD. By providing multi-environment configurations, code reuse, better organization, and easier version control, it simplifies and streamlines the process for customers.

You’ll find more information about KrakenD Flexible Configuration in our documentation.

Additionally, some of our case studies, such as Rappi and Hepsiburada, demonstrate successful management of complex scenarios that involve thousands of microservices and multiple teams collaborating on the maintenance of KrakenD setups. These examples can provide valuable insights and strategies for handling similar situations in your own organization.

Note to our readers: Don’t forget to check out our YouTube channel for informative videos on KrakenD features and best practices. Subscribe and stay updated on our latest content to enhance your KrakenD experience.

Scarf
 Stay up to date with KrakenD releases and important updates