feat: Misskeyのプロトコルとパスを指定できるように

This commit is contained in:
usbharu 2025-04-20 17:34:53 +09:00
parent 390880343b
commit 0bc7588984
Signed by: usbharu
GPG Key ID: 8CB1087135660B8D
1 changed files with 8 additions and 1 deletions

View File

@ -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