-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
98 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config_prod.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package auth | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
const ( | ||
CollectionEmailConfirmation string = "email_confirmations_tmp" | ||
CollectionPasswordChange string = "password_change_tmp" | ||
) | ||
|
||
const ( | ||
emailConfirmExpireTime time.Duration = time.Hour*7 | ||
passwordChangeExpireTime time.Duration = time.Hour*1 | ||
) | ||
|
||
|
||
type tempOpsToken struct{ | ||
UserId string | ||
Token []byte | ||
Used bool | ||
ExpireAt int64 | ||
} | ||
|
||
|
||
type emailConfirmation struct{ | ||
tempOpsToken | ||
} | ||
|
||
type passwordChange struct{ | ||
tempOpsToken | ||
} |
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,7 @@ | ||
{ | ||
"emails":[ | ||
{"address":"[email protected]", "password":"testing"}, | ||
{"address":"[email protected]", "password":"testing"} | ||
], | ||
"jwtkey":"testing" | ||
} |
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,30 @@ | ||
package config | ||
|
||
import ( | ||
"os" | ||
"encoding/json" | ||
) | ||
|
||
type Configuration struct{ | ||
emails []email | ||
jwtkey string | ||
} | ||
|
||
type email struct{ | ||
address string | ||
password string | ||
} | ||
|
||
func GetConfig() Configuration{ | ||
file,err:=os.Open("config.json") | ||
if err != nil{ | ||
panic("Configuration file missing!") | ||
} | ||
decoder := json.NewDecoder(file) | ||
config := Configuration{} | ||
decodeErr := decoder.Decode(config) | ||
if decoder!=nil { | ||
panic("Configuration file error") | ||
} | ||
return config | ||
} |