Skip to content

Commit

Permalink
Custom .env path (#25)
Browse files Browse the repository at this point in the history
* Custom .env path
hwbrzzl authored Feb 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5d9bf95 commit 6f61860
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ Golang developers quickly build their own applications.

## Roadmap

- [ ] Custom .env path
- [ ] Database read-write separation
- [ ] Extend Redis driver

1 change: 0 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ Goravel 是一个功能完备、具有良好扩展能力的 Web 应用程序框

## 路线图

- [ ] 自定义 .env 路径
- [ ] 数据库读写分离
- [ ] 扩展 Redis 驱动

6 changes: 5 additions & 1 deletion config/service_provider.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package config

import (
"flag"

"github.com/goravel/framework/facades"
)

type ServiceProvider struct {
}

func (config *ServiceProvider) Register() {
facades.Config = NewApplication(".env")
env := flag.String("env", ".env", "custom .env path")
flag.Parse()
facades.Config = NewApplication(*env)
}

func (config *ServiceProvider) Boot() {

0 comments on commit 6f61860

Please sign in to comment.