tex: add stuff on app architecture
This commit is contained in:
parent
0da94ed5d0
commit
7fc9e36f63
20
tex/text.tex
20
tex/text.tex
@ -792,6 +792,26 @@ official formatting standards.
|
||||
|
||||
\n{1}{Application architecture}
|
||||
|
||||
The source code is split into Go \emph{packages} appropriately along a couple
|
||||
of domains: logging, core application, web routers, configuration and settings,
|
||||
etc. In Go, a package is delimited by folder structure -- each folder is a
|
||||
package.
|
||||
|
||||
Generally speaking, the program aggregates decision points into central places,
|
||||
such as \texttt{run.go}, which imports child packages that facilitate each of
|
||||
loading the configuration, connecting to the database and running migrations,
|
||||
consolidating flag, environment variable and configuration-based values into
|
||||
canonical \emph{settings}, setting up routes and handling graceful shutdown.
|
||||
|
||||
The program uses dependency injection to share a single logger instance,
|
||||
similar applies to the database client. These are passed around as a pointer,
|
||||
so the underlying data stays the same. As a rule of thumb, every larger
|
||||
\texttt{struct} that needs to be passed around is passed around as a pointer.
|
||||
|
||||
Authentication logic is relatively simple and the author would like to isolate
|
||||
it into a custom \emph{middleware} but that is a future work.
|
||||
|
||||
|
||||
\n{1}{Implementation}
|
||||
|
||||
\n{2}{Configuration}
|
||||
|
Reference in New Issue
Block a user