lledargo / zerobased

A zero based budgeting application
GNU General Public License v3.0
0 stars 0 forks source link

production mode #3

Open lledargo opened 10 months ago

lledargo commented 10 months ago

In production we need the ability to specify

My first instinct is to do this through environment variables.

lledargo commented 1 month ago

4af21f196274b716e237befeafae9c64fbea53f3

At this stage I am hard coding the API/Client listening sockets and CORS configuration for production to work with my production deployments which use deno to serve the bundled web client from ./static/. I would like the API to be more client agnostic in the future. Unfortunatly this is difficult because deno compile results in a binary which does not look at the host systems environment variables for configuration, hence the method for configuring the database connection below. At some point I'll look into different options for bundling the deno server.

Database credentials can be passed to the API via a json, ./db.json defined by this deno-postgres interface.

interface ClientOptions {
  applicationName?: string;
  connection?: Partial<ConnectionOptions>;
  database?: string;
  hostname?: string;
  host_type?: "tcp" | "socket";
  options?: string | Record<string, string>;
  password?: string;
  port?: string | number;
  tls?: Partial<TLSOptions>;
  user?: string;
}