set up config to use .env values in plans for switching to containers
diff --git a/.gitignore b/.gitignore
index 03b27c2..8be3b9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,8 @@
dist/
.history/
node_modules/
-src/config/*
-!src/config/*.d.ts
-!src/config/format.ts
-!src/config/default.ts
-!src/config/emojis.ts
src/utils/migration/data
-src/config/main.ts
.vscode/
.vim/
yarn-error.log
@@ -21,3 +15,134 @@
ClicksMigratingProblems/oldData copy/
.direnv/
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+.pnpm-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# Snowpack dependency directory (https://snowpack.dev/)
+web_modules/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional stylelint cache
+.stylelintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variable files
+.env
+.env.development.local
+.env.test.local
+.env.production.local
+.env.local
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+.parcel-cache
+
+# Next.js build output
+.next
+out
+
+# Nuxt.js build / generate output
+.nuxt
+dist
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and not Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress build output
+.vuepress/dist
+
+# vuepress v2.x temp and cache directory
+.temp
+.cache
+
+# Docusaurus cache and generated files
+.docusaurus
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# TernJS port file
+.tern-port
+
+# Stores VSCode versions used for testing VSCode extensions
+.vscode-test
+
+# yarn v2
+.yarn/cache
+.yarn/unplugged
+.yarn/build-state.yml
+.yarn/install-state.gz
+.pnp.*
diff --git a/package.json b/package.json
index 87f3cb2..4f9bec9 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"dependencies": {
+ "@clicks/nsfwjs": "^3.0.2",
"@hokify/agenda": "^6.3.0",
"@octokit/graphql": "^5.0.6",
"@tensorflow/tfjs": "^4.7.0",
@@ -12,6 +13,7 @@
"clamscan": "^2.1.2",
"diff": "^5.1.0",
"discord.js": "^14.11.0",
+ "dotenv": "^16.1.4",
"eslint": "^8.42.0",
"express": "^4.18.2",
"fuse.js": "^6.6.2",
@@ -22,7 +24,6 @@
"mongodb": "^5.6.0",
"node-fetch": "^3.3.1",
"node-tesseract-ocr": "^2.2.1",
- "@clicks/nsfwjs": "^3.0.2",
"octokit": "^2.0.19",
"seedrandom": "^3.0.5",
"structured-clone": "^0.2.2",
@@ -35,7 +36,7 @@
"scripts": {
"build": "tsc && pnpm copy-files",
"copy-files": "copyfiles -u 1 src/reflex/nsfwjs/example/nsfw_demo/public/model/**/* dist/",
- "start": "node --experimental-json-modules --enable-source-maps dist/index.js",
+ "start": "node --experimental-json-modules --enable-source-maps -r dotenv/config dist/index.js",
"dev": "rm -rf dist && eslint src --fix && pnpm build && node --experimental-json-modules --enable-source-maps dist/index.js",
"force-dev": "clear; rm -rf dist; tsc-suppress && pnpm copy-files && node --experimental-json-modules --enable-source-maps dist/index.js",
"lint": "echo 'Style checking...'; prettier --check .; echo 'Linting...'; eslint src; echo 'To auto-fix everything possible, please run `pnpm lint-fix`'; true",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 117004c..18b1954 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -40,6 +40,9 @@
discord.js:
specifier: ^14.11.0
version: 14.11.0
+ dotenv:
+ specifier: ^16.1.4
+ version: 16.1.4
eslint:
specifier: ^8.42.0
version: 8.42.0
@@ -2596,6 +2599,11 @@
dependencies:
esutils: 2.0.3
+ /dotenv@16.1.4:
+ resolution: {integrity: sha512-m55RtE8AsPeJBpOIFKihEmqUcoVncQIwo7x9U8ZwLEZw9ZpXboz2c+rvog+jUaJvVrZ5kBOeYQBX5+8Aa/OZQw==}
+ engines: {node: '>=12'}
+ dev: false
+
/each-parallel-async@1.0.0:
resolution: {integrity: sha512-P/9kLQiQj0vZNzphvKKTgRgMnlqs5cJsxeAiuog1jrUnwv0Z3hVUwJDQiP7MnLb2I9S15nR9SRUceFT9IxtqRg==}
engines: {node: '>=0.10.0'}
diff --git a/src/config/main.d.ts b/src/config/main.d.ts
deleted file mode 100644
index 6c610e0..0000000
--- a/src/config/main.d.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-declare const config: {
- developmentToken: string;
- developmentGuildID: string;
- enableDevelopment: boolean;
- token: string;
- managementGuildID: string;
- owners: string[];
- commandsFolder: string;
- eventsFolder: string;
- messageContextFolder: string;
- userContextFolder: string;
- verifySecret: string;
- mongoOptions: {
- username: string;
- password: string;
- database: string;
- host: string;
- authSource: string;
- };
- baseUrl: string;
- clamav: {
- socket?: string;
- host?: string;
- port?: number;
- };
- githubPAT: string;
- suggestionChannel: string;
-};
-
-export default config;
diff --git a/src/config/main.ts b/src/config/main.ts
new file mode 100644
index 0000000..ae34ff7
--- /dev/null
+++ b/src/config/main.ts
@@ -0,0 +1,58 @@
+interface config {
+ developmentToken: string;
+ developmentGuildID: string;
+ enableDevelopment: boolean;
+ token: string;
+ managementGuildID: string;
+ owners: string[];
+ commandsFolder: string;
+ eventsFolder: string;
+ messageContextFolder: string;
+ userContextFolder: string;
+ verifySecret: string;
+ mongoOptions: {
+ username: string;
+ password: string;
+ database: string;
+ host: string;
+ authSource: string;
+ };
+ baseUrl: string;
+ clamav: {
+ socket?: string;
+ host?: string;
+ port?: number;
+ };
+ githubPAT: string;
+ suggestionChannel: string;
+};
+
+export default {
+ "token": process.env["TOKEN"]!,
+ "developmentToken": process.env["DEV_TOKEN"]!,
+ "managementGuildID": process.env["MANAGEMENT_GUILD_ID"]!,
+ "developmentGuildID": process.env["DEV_GUILD_ID"]!,
+ "enableDevelopment": process.env["ENABLE_DEV"] === "true",
+ "owners": process.env["OWNERS"]?.split(","),
+
+ "commandsFolder": process.env["COMMANDS_FOLDER"] ?? "dist/commands",
+ "eventsFolder": process.env["EVENTS_FOLDER"] ?? "dist/events",
+ "messageContextFolder": process.env["MESSAGE_CONTEXT_FOLDER"] ?? "dist/context/messages",
+ "userContextFolder": process.env["USER_CONTEXT_FOLDER"] ?? "dist/context/users",
+
+ "verifySecret": process.env["VERIFY_SECRET"]!,
+ "mongoOptions": {
+ "username": process.env["MONGO_USERNAME"]!,
+ "password": process.env["MONGO_PASSWORD"]!,
+ "host": process.env["MONGO_HOST"]!,
+ "database": process.env["MONGO_DATABASE"]!,
+ "authSource": process.env["MONGO_AUTH_SOURCE"]!,
+ },
+ "baseUrl": process.env["BASE_URL"]!,
+ "clamav": {
+ "host": process.env["CLAMAV_HOST"]!,
+ "port": parseInt(process.env["CLAMAV_PORT"] ?? "3310")
+ },
+ "githubPAT": process.env["GITHUB_PAT"]!,
+ "suggestionChannel": process.env["SUGGESTION_CHANNEL"]!,
+} as config;
\ No newline at end of file