Administering database variables in Rails -


I am currently implementing multi-tenant logic in an app, and it is quite easy, so now I have long Stuffed from time for all the variables, the word storage variables are derived from Herocua database_url .

  Def NV_Virables {Host: NIF.FET ("# {@ company_id} _DB_HOST"), Port: ENV ["# {@ Company_id} _DB_PORT", Username: ENV.fetch ( "# {@ Company_id} _DB_USERNAME"), password: ENV.fetch ("# {@ company_id} _DB_PASSWORD"), database: ENV.fetch ("# {@company_id} _DB_DATABASE"),} end  

It is quite easy to bring the variables related to the INV, but the administration of 40-50 and the variable can be painful.

Choice such as I see them

< Ol>
  • set the ANV-variable in a reply-script Things to do.
  • Store the database variable in files in the project. Probably easier to manage, but to be deployed before being effective.
  • Do I get some terrible solutions? How do people usually go about storing large amounts of database variables?

    ENV

    However, I'm sure you can store data in a file I will try to keep them individually in NV Wars (probably)

    The reason for this is that the ENV variables are stored deep in the stack (in the OS), and as a result, the rail itself is actually If the company id is not being changed (they are not dynamic), then I will put them in a Figaro application.yml file:

      # Config / application.yml 156_DB_DATABASE: "db" etc.  

    Comments