get cwd for .env
This commit is contained in:
2 files changed
+5
-2
No files matched your search
@@ -17,7 +17,7 @@ A script to automatically handle the backing up of MongoDB databases and optiona
|
||||
3. Setup your service on your UNIX-based OS, for example an Ubuntu Server.
|
||||
**i.** Build the project to a binary.
|
||||
```bash
|
||||
$ go build
|
||||
$ go build main.go
|
||||
```
|
||||
**ii.** Create a System Service file
|
||||
```bash
|
||||
|
||||
@@ -55,8 +55,11 @@ func UploadToGithub(archiveDir string) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
path, err := os.Getwd()
|
||||
Handle(err)
|
||||
|
||||
// Load environment variables
|
||||
godotenv.Load(".env")
|
||||
godotenv.Load(fmt.Sprintf("%s/.env", path))
|
||||
var mongoURI string = os.Getenv("mongoURI")
|
||||
var database_string string = os.Getenv("databases")
|
||||
var github string = os.Getenv("github")
|
||||
|
||||
Reference in new issue
Block a user