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.
|
3. Setup your service on your UNIX-based OS, for example an Ubuntu Server.
|
||||||
**i.** Build the project to a binary.
|
**i.** Build the project to a binary.
|
||||||
```bash
|
```bash
|
||||||
$ go build
|
$ go build main.go
|
||||||
```
|
```
|
||||||
**ii.** Create a System Service file
|
**ii.** Create a System Service file
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -55,8 +55,11 @@ func UploadToGithub(archiveDir string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
path, err := os.Getwd()
|
||||||
|
Handle(err)
|
||||||
|
|
||||||
// Load environment variables
|
// Load environment variables
|
||||||
godotenv.Load(".env")
|
godotenv.Load(fmt.Sprintf("%s/.env", path))
|
||||||
var mongoURI string = os.Getenv("mongoURI")
|
var mongoURI string = os.Getenv("mongoURI")
|
||||||
var database_string string = os.Getenv("databases")
|
var database_string string = os.Getenv("databases")
|
||||||
var github string = os.Getenv("github")
|
var github string = os.Getenv("github")
|
||||||
|
|||||||
Reference in new issue
Block a user