Docker build & push (#2)

* Simple docker build and push
* Removed requirement of defining in the config.toml file, everything should be available from the environment
* Added workflow dispatch
This commit is contained in:
Andrew Pennington 2024-08-15 19:12:31 +01:00 committed by GitHub
parent 2da65182cb
commit 7d5eec898d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 19 deletions

View file

@ -1,6 +1,7 @@
import fs from 'fs';
import path from 'path';
import toml from '@iarna/toml';
import process from 'process';
const configFileName = 'config.toml';
@ -29,20 +30,25 @@ const loadConfig = () =>
fs.readFileSync(path.join(__dirname, `../${configFileName}`), 'utf-8'),
) as any as Config;
export const getPort = () => loadConfig().GENERAL.PORT;
export const getPort = () => process.env.PORT ?? loadConfig().GENERAL.PORT;
export const getSimilarityMeasure = () =>
loadConfig().GENERAL.SIMILARITY_MEASURE;
process.env.SIMILARITY_MEASURE ?? loadConfig().GENERAL.SIMILARITY_MEASURE;
export const getOpenaiApiKey = () => loadConfig().API_KEYS.OPENAI;
export const getOpenaiApiKey = () =>
process.env.OPENAI_API_KEY ?? loadConfig().API_KEYS.OPENAI;
export const getGroqApiKey = () => loadConfig().API_KEYS.GROQ;
export const getGroqApiKey = () =>
process.env.GROQ_API_KEY ?? loadConfig().API_KEYS.GROQ;
export const getAnthropicApiKey = () => loadConfig().API_KEYS.ANTHROPIC;
export const getAnthropicApiKey = () =>
process.env.ANTHROPIC_API_KEY ?? loadConfig().API_KEYS.ANTHROPIC;
export const getSearxngApiEndpoint = () => loadConfig().API_ENDPOINTS.SEARXNG;
export const getSearxngApiEndpoint = () =>
process.env.SEARXNG_API_ENDPOINT ?? loadConfig().API_ENDPOINTS.SEARXNG;
export const getOllamaApiEndpoint = () => loadConfig().API_ENDPOINTS.OLLAMA;
export const getOllamaApiEndpoint = () =>
process.env.OLLAMA_API_ENDPOINT ?? loadConfig().API_ENDPOINTS.OLLAMA;
export const updateConfig = (config: RecursivePartial<Config>) => {
const currentConfig = loadConfig();