Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Migrate = &cobra.Command{ Use: "migrate", Short: "Migrate the database", RunE: func(cmd *cobra.Command, args []string) error { conn, err := gorm.Open(postgres.Open(cfg.Flags.DatabaseURI), &gorm.Config{ NamingStrategy: schema.NamingStrategy{ TablePrefix: cfg.Flags.DatabaseTablePrefix, }, }) if err != nil { return err } db, err := db.NewDB(conn) if err != nil { return err } err = db.Migrate(cmd.Context()) if err != nil { return err } return nil }, }
View Source
var Root = &cobra.Command{ PersistentPreRunE: func(cmd *cobra.Command, args []string) error { err := envconfig.Process("", cfg.Flags) if err != nil { return err } return nil }, RunE: func(cmd *cobra.Command, args []string) error { srv := NewWebSrv(cfg) s, _ := server.WithContext(cmd.Context()) s.Listen(srv, false) return s.Wait() }, }
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
Addr string
Database string
Password string
Port int
Username string
Prefix string
}
DB ...
type Flags ¶
type Flags struct {
Addr string `envconfig:"TYPHOON_WEB_ADDR" default:":8080"`
DatabaseURI string `envconfig:"TYPHOON_WEB_DATABASE_URI" default:""`
DatabaseTablePrefix string `envconfig:"TYPHOON_WEB_DATABASE_TABLE_PREFIX" default:"typhoon_"`
FGAApiUrl string `envconfig:"TYPHOON_WEB_FGA_API_URL" default:"http://host.docker.internal:8080"`
FGAStoreID string `envconfig:"TYPHOON_WEB_FGA_STORE_ID" default:""`
FGAAuthorizationModelID string `envconfig:"TYPHOON_WEB_FGA_AUTHORIZATION_MODEL_ID" default:""`
GothGitbubKey string `envconfig:"TYPHOON_WEB_GITHUB_CLIENT_ID" default:""`
GothGithubSecret string `envconfig:"TYPHOON_WEB_GITHUB_SECRET" default:""`
GothGithubCallback string `envconfig:"TYPHOON_WEB_GITHUB_CALLBACK" default:"http://localhost:8080/auth/github/callback"`
}
Flags contains the command line flags.
Click to show internal directories.
Click to hide internal directories.