feat: Misskeyのプロトコルとパスを指定できるように
This commit is contained in:
parent
390880343b
commit
0bc7588984
9
main.go
9
main.go
|
@ -17,6 +17,8 @@ import (
|
|||
|
||||
var client *misskey.Client
|
||||
var endpoint = os.Getenv("MISSKEY_ENDPOINT")
|
||||
var protocol, hasProtocolEnv = os.LookupEnv("MISSKEY_PROTOCOL")
|
||||
var path = os.Getenv("MISSKEY_PATH")
|
||||
var apiKey = os.Getenv("MISSKEY_API_TOKEN")
|
||||
|
||||
var (
|
||||
|
@ -155,9 +157,14 @@ var (
|
|||
)
|
||||
|
||||
func main() {
|
||||
|
||||
if !hasProtocolEnv {
|
||||
protocol = "https"
|
||||
}
|
||||
|
||||
options, err := misskey.NewClientWithOptions(
|
||||
misskey.WithAPIToken(apiKey),
|
||||
misskey.WithBaseURL("https", endpoint, ""),
|
||||
misskey.WithBaseURL(protocol, endpoint, path),
|
||||
misskey.WithLogLevel(logrus.InfoLevel),
|
||||
)
|
||||
client = options
|
||||
|
|
Loading…
Reference in New Issue