Skip to content

graphql: Remove init() and inject parsed Schema where needed

Administrator requested to merge graphql/dependency-injection into master

Created by: mrnugget

After running into nil panics because the schema was parsed before dbconn.Global was initialized, this changes the code so that we can inject a database connection into the schema constructor.

Previously all stores in the db package used dbconn.Global and there was an implicit order of the calls (first the dbconn.Global was initialized, then the stores were called, ...).

This makes the initialization order explicit by changing the Main() function in the cli package to first set up a database connection and then parse the schema and then set up the handlers.

Merge request reports

Loading