Skip to content

Commit

Permalink
feat: move config.env to .env.
Browse files Browse the repository at this point in the history
Loading configurations from config.env is now moved to .env. The sample file is now .env.sample . This is beacause the latter is the conventional style which I was unaware of at the time I first implemented it. There is still full backwards compatibility with config.env file.
  • Loading branch information
Jisin0 committed Jul 26, 2024
1 parent 63b1209 commit 5e97878
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion sample.config.env → .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BOT_TOKEN = 123456789:AATiuhBBy6oIL9r54yYLs7CSn
FSUB = -1002235842999 -1001898719761
PROTECT_CONTENT = true
PROTECT_CONTENT = true
AUTO_DELETE = 10
ADMINS = 123456789 1093541873
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ go.work.sum
/.vscode

# Local environment configs
config.env
.env

# Cache file from autodelete
cache.sqlite
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ id - Get user id or forwarded channel id.

## Variables

Variables can also be loaded by creating a ```config.env``` file at the root of the repository. See [sample.config.env](/sample.config.env) to see the format to use.
Variables can also be loaded by creating a ```.env``` file at the root of the repository. See [.env.sample](/.env.sample) to see the format to use.

- `BOT_TOKEN` : Optional. On vercel, a list of bot tokens allowed to connect to the app or leave empty allow anyone to connect. On servers, a single bot token.
- `ADMINS` : Optional. List of telegram IDs of users allowed to create links with the bot, seperated by spaces.
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ var (
)

func init() {
err := godotenv.Load("config.env")
err := godotenv.Load(".env", "config.env") // config.env is deprecated and only for backward compatibiity
if err == nil {
fmt.Println("configs loaded from config.env file")
fmt.Println("configs loaded from .env file")
}

DBChannel = int64Environ("DB_CHANNEL")
Expand Down

0 comments on commit 5e97878

Please sign in to comment.