-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from itsumura-h/fix_mysql_insert_bool
fix to load .env/fix mysql insert bool
- Loading branch information
Showing
6 changed files
with
73 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os, strutils | ||
import dotenv | ||
|
||
for f in walkDir(getCurrentDir()): | ||
if f.path.contains(".env"): | ||
let env = initDotEnv(getCurrentDir(), f.path.split("/")[^1]) | ||
env.load() | ||
echo("used config file '", f.path, "'") | ||
|
||
const | ||
DRIVER* = getEnv("DB_DRIVER","sqlite").string | ||
|
||
let | ||
CONN* = getEnv("DB_CONNECTION", getCurrentDir() / "db.sqlite3").string | ||
USER* = getEnv("DB_USER", "").string | ||
PASSWORD* = getEnv("DB_PASSWORD", "").string | ||
DATABASE* = getEnv("DB_DATABASE", "").string | ||
MAX_CONNECTION* = getEnv("DB_MAX_CONNECTION", "1").parseInt | ||
IS_DISPLAY* = if existsEnv("LOG_IS_DISPLAY"): getEnv("LOG_IS_DISPLAY").string.parseBool else: false | ||
IS_FILE* = if existsEnv("LOG_IS_FILE"): getEnv("LOG_IS_FILE").string.parseBool else: false | ||
LOG_DIR* = if existsEnv("LOG_DIR"): getEnv("LOG_DIR").string else: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters