Fixed env stuff

This commit is contained in:
Benjamin Sherriff
2024-05-04 14:00:54 -04:00
parent e497ce243e
commit 345dc105df
6 changed files with 32 additions and 15 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
# Common # Common
keys/ keys/
.env .env*.local
# Service # Service
target/ target/

View File

@@ -1,16 +1,16 @@
RUST_LOG=warn,service=info RUST_LOG=warn,service=debug
DATABASE_USER=siren DATABASE_USER=siren
DATABASE_PASSWORD= #Required DATABASE_PASSWORD= # FILL ME IN
DATABASE_NAME=siren DATABASE_NAME=siren
DATABASE_HOST=localhost DATABASE_HOST=localhost
DATABASE_PORT=5432 DATABASE_PORT=5432
KEYS_DIR_PATH= KEYS_DIR_PATH= # OPTIONAL
SESSION_TTL=1440 SESSION_TTL=1440
MINIO_ROOT_USER=siren MINIO_ROOT_USER=siren
MINIO_ROOT_PASSWORD= #Required MINIO_ROOT_PASSWORD= # FILL ME IN
MINIO_HOST=localhost MINIO_HOST=localhost
MINIO_PORT=9000 MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001 MINIO_PORT_INTERNAL=9001
@@ -20,8 +20,8 @@ REDIS_PORT=6379
SERVICE_HOST=localhost SERVICE_HOST=localhost
SERVICE_PORT=5000 SERVICE_PORT=5000
DATA_DIR_PATH= DATA_DIR_PATH= # OPTIONAL
DISCORD_TOKEN= #Required DISCORD_TOKEN= # OPTIONAL
OPENAI_API_KEY= OPENAI_API_KEY= # OPTIONAL
OPENAI_API_MODEL=gpt-3.5-turbo OPENAI_API_MODEL=gpt-3.5-turbo-0125

View File

@@ -1,7 +1,11 @@
#!make #!make
SHELL := /bin/bash SHELL := /bin/bash
GIT_HASH ?= $(shell git log --format="%h" -n 1)
export VERSION=$(if $(v),$(v),latest)
include .env include .env
-include .env.local
export
.PHONY: help build test up down exec clean .PHONY: help build test up down exec clean
@@ -16,8 +20,20 @@ up: ## Start the backend containers
down: ## Stop the backend containers down: ## Stop the backend containers
@docker compose --profile backend down @docker compose --profile backend down
run: ## Run the app run: ## Run the project
@echo "Running project..."
@cargo run @cargo run
@echo "Run complete"
format: ## Format code
@echo "Formatting code..."
@cargo fmt
@echo "Format complete"
clean: ## Clean the project
@echo "Cleaning project..."
@cargo clean
@echo "Clean complete"
docker-up: ## Start the app docker-up: ## Start the app
@docker compose --profile backend --profile siren up -d @docker compose --profile backend --profile siren up -d
@@ -28,7 +44,7 @@ docker-down: ## Stop the app
docker-build: ## Build the docker image docker-build: ## Build the docker image
@docker compose build @docker compose build
clean: ## Clean the app docker-clean: ## Clean the app
@docker compose down && \ @docker compose down && \
docker image rm siren-service || \ docker image rm siren-service || \
docker network rm siren_frontend || \ docker network rm siren_frontend || \

3
service/rustfmt.toml Normal file
View File

@@ -0,0 +1,3 @@
indent_style = "Block"
reorder_imports = false
tab_spaces = 2

View File

@@ -16,8 +16,6 @@ use actix_cors::Cors;
use actix_web::{HttpServer, App, web}; use actix_web::{HttpServer, App, web};
use crate::bot::handler::Handler; use crate::bot::handler::Handler;
use dotenv::dotenv;
mod auth; mod auth;
mod dnd; mod dnd;
mod bot; mod bot;
@@ -26,7 +24,7 @@ mod users;
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
dotenv().ok(); dotenv::dotenv().ok();
env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "warn,siren=info")); env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "warn,siren=info"));
storage::init().await; storage::init().await;
match env::var("DATA_DIR_PATH") { match env::var("DATA_DIR_PATH") {

View File

@@ -1,5 +1,5 @@
SERVICE_HOST=service SERVICE_HOST=service
SERVICE_PORT=5000 SERVICE_PORT=5000
UI_PORT=8080 UI_PORT=3000
NODE_ENV=development NODE_ENV=development