Release v0.0.1 - Initial OAuth2 server implementation
- Add Nostr OAuth2 server with NIP-98 authentication support - Implement OAuth2 authorization and token endpoints - Add .well-known/openid-configuration discovery endpoint - Include Dockerfile for containerized deployment - Add Claude Code release command for version management - Create example configuration file 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
41
cmd/nostr-oauth2-server/main.go
Normal file
41
cmd/nostr-oauth2-server/main.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"git.mleku.dev/mleku/gitea-nostr-auth/internal/config"
|
||||
"git.mleku.dev/mleku/gitea-nostr-auth/internal/handler"
|
||||
"git.mleku.dev/mleku/gitea-nostr-auth/internal/nostr"
|
||||
"git.mleku.dev/mleku/gitea-nostr-auth/internal/oauth2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
configPath := flag.String("config", "config.yaml", "path to config file")
|
||||
flag.Parse()
|
||||
|
||||
cfg, err := config.Load(*configPath)
|
||||
if err != nil {
|
||||
// Try environment variables if config file not found
|
||||
if os.IsNotExist(err) {
|
||||
cfg = config.FromEnv()
|
||||
} else {
|
||||
log.Fatalf("failed to load config: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
store := oauth2.NewMemoryStore()
|
||||
fetcher := nostr.NewFetcher(cfg.Nostr.FallbackRelays)
|
||||
router := handler.NewRouter(cfg, store, fetcher)
|
||||
|
||||
addr := cfg.Server.Address()
|
||||
log.Printf("Starting nostr-oauth2-server on %s", addr)
|
||||
log.Printf("Base URL: %s", cfg.Server.BaseURL)
|
||||
log.Printf("Fallback relays: %v", cfg.Nostr.FallbackRelays)
|
||||
|
||||
if err := http.ListenAndServe(addr, router); err != nil {
|
||||
log.Fatalf("server error: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user