Skip to content

Flamingo Bootstrap

Configuration context areas

You can have several configuration areas in your project.

Configuration areas have:

  • a name
  • a list of modules to load
  • a baseurl that will cause Flamingo to "detect" and use that configuration area
  • child config areas

With the concept of having children, the config areas in your project can form a tree. Inside the tree, most of the configurations and modules are inherited to the children.

This concept is mainly used to configure different websites/channels with different locales or different implementations of certain ports for example.

Using the default flamingo.App

A typical Flamingo application with multiple config areas will look like this:

Folder structure:

main.go
config
└───config.yml
│   └───config.yml
└───de
│   └───config.yml
└───en
    └───config.yml  

Inside main.go you can use the flamingo.App as an entrypoint to run your application:

func main() {

    flamingo.App([]dingo.Module{
        //flamingo framework modules:
        new(requestlogger.Module), // requestlogger show request logs
        new(prefixrouter.Module),
        new(pugtemplate.Module),
        new(locale.Module),
        new(opencensus.Module),
        new(auth.Module),

        //flamingo-commerce modules
        new(product.Module),
        new(price.Module),
        new(category.Module),
        new(cart.Module),
        new(customer.Module),
        new(checkout.Module),

        //flamingo-commerce-adpater-standalone
        new(csvcommerce.ProductClientModule),
        new(csvcommerce.SearchClientModule),
    }, flamingo.ChildAreas(
        config.NewArea("de", nil),
        config.NewArea("en", nil),
    ))
}