forked from ProjectSegfault/publapi
retrieve username from args instead of envfile
This commit is contained in:
parent
b8c03015ef
commit
7a3ed3d955
@ -1,4 +1,3 @@
|
|||||||
USERNAME=testuser
|
|
||||||
FULL_NAME="Test User"
|
FULL_NAME="Test User"
|
||||||
GEMINI_CAPSULE=gemini://test.com
|
GEMINI_CAPSULE=gemini://test.com
|
||||||
WEBSITE=https://test.com
|
WEBSITE=https://test.com
|
||||||
|
9
main.go
9
main.go
@ -20,12 +20,12 @@ type Userstruct struct {
|
|||||||
type Userinfo struct {
|
type Userinfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
FullName string `json:"fullName"`
|
FullName string `json:"fullName"`
|
||||||
Loc string `json:"loc"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
Desc string `json:"desc"`
|
Desc string `json:"desc"`
|
||||||
|
Online bool `json:"online"`
|
||||||
|
Email string `json:"email"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
Capsule string `json:"capsule"`
|
Capsule string `json:"capsule"`
|
||||||
Online bool `json:"online"`
|
Loc string `json:"loc"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dedup(input string) string {
|
func Dedup(input string) string {
|
||||||
@ -60,6 +60,7 @@ func userdata(username, usersonline string) Userinfo {
|
|||||||
if os.IsNotExist(error) {
|
if os.IsNotExist(error) {
|
||||||
log.Error(username + " does not have a meta-info.env")
|
log.Error(username + " does not have a meta-info.env")
|
||||||
var user Userinfo
|
var user Userinfo
|
||||||
|
user.Name = username
|
||||||
if strings.Contains(usersonline, " "+username) == true {
|
if strings.Contains(usersonline, " "+username) == true {
|
||||||
user.Online = true
|
user.Online = true
|
||||||
} else {
|
} else {
|
||||||
@ -71,7 +72,7 @@ func userdata(username, usersonline string) Userinfo {
|
|||||||
viper.SetConfigFile(filename)
|
viper.SetConfigFile(filename)
|
||||||
viper.ReadInConfig()
|
viper.ReadInConfig()
|
||||||
var user Userinfo
|
var user Userinfo
|
||||||
user.Name = viper.GetString("USERNAME")
|
user.Name = username
|
||||||
user.FullName = viper.GetString("FULL_NAME")
|
user.FullName = viper.GetString("FULL_NAME")
|
||||||
user.Capsule = viper.GetString("GEMINI_CAPSULE")
|
user.Capsule = viper.GetString("GEMINI_CAPSULE")
|
||||||
user.Website = viper.GetString("WEBSITE")
|
user.Website = viper.GetString("WEBSITE")
|
||||||
|
Loading…
Reference in New Issue
Block a user