hackf / rpi_door

MIT License
2 stars 3 forks source link

Configuration #5

Open Taar opened 10 years ago

Taar commented 10 years ago

There needs to be a way pass in configuration either through a file or passing in parameters when the class is instantiated.

bubbapizza commented 10 years ago

I would agree with the config file thing - the line in door.py:

rpi_door = RPiDoor(**{ "sqlalchemy.url": "sqlite://database.db", "sqlalchemy.echo": False, "sqlalchemy.pool_recycle": 3600 })

As a sysadmin, I think this belongs in a simple language-neutral config file. For inspiration, you could ripoff the config files for freeradius. Maybe start with something simple like /etc/doorcontroller/controller.conf.:

===== controller.conf =====

### Configure SQL backend parameters.  Uncomment to modify defaults.
sql {
   # Set the databases to one of sqllite, mysql, postresql, oracle
   # database = sqllite

  ##### Connection info #####

  # For sqllite only:
  # filename=database.db

   # All other databases connection info:
   # server = "localhost"
   # port = 3306
   # login = "root"
   # password = "password"
}