1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

PRovide basic in-app purchase/renewal flow

This commit is contained in:
Harvey Kandola 2018-11-05 19:48:50 +00:00
parent e116d3b000
commit d1b803b246
39 changed files with 1211 additions and 1154 deletions

View file

@ -64,7 +64,7 @@ func InitRuntime(r *env.Runtime, s *store.Store) bool {
// Open connection to database
db, err := sqlx.Open(r.StoreProvider.DriverName(), r.StoreProvider.MakeConnectionString()) //r.Flags.DBConn
if err != nil {
r.Log.Error("unable to setup database", err)
r.Log.Error("unable to open database", err)
}
// Database handle
@ -94,6 +94,3 @@ func InitRuntime(r *env.Runtime, s *store.Store) bool {
return true
}
// Clever way to detect database type:
// https://github.com/golang-sql/sqlexp/blob/c2488a8be21d20d31abf0d05c2735efd2d09afe4/quoter.go#L46

View file

@ -14,9 +14,10 @@ package main
import (
"fmt"
"time"
"os"
"github.com/documize/community/core/env"
"github.com/documize/community/domain"
"github.com/documize/community/domain/section"
"github.com/documize/community/domain/store"
"github.com/documize/community/edition/boot"
@ -37,26 +38,27 @@ func main() {
web.Embed = embed.NewEmbedder()
// product details
rt.Product = env.Product{}
rt.Product = domain.Product{}
rt.Product.Major = "1"
rt.Product.Minor = "72"
rt.Product.Patch = "1"
rt.Product.Minor = "73"
rt.Product.Patch = "0"
rt.Product.Revision = 181022154519
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
rt.Product.Edition = env.CommunityEdition
rt.Product.Edition = domain.CommunityEdition
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
// Community edition is good to go with no user limits.
rt.Product.License = env.License{Edition: env.CommunityEdition, Seats: env.Seats6, Trial: false,
Start: time.Now().UTC(), End: time.Now().UTC().Add(time.Hour * 24 * 7 * time.Duration(52))}
// Setup data store.
s := store.Store{}
// parse settings from command line and environment
rt.Flags = env.ParseFlags()
flagsOK := boot.InitRuntime(&rt, &s)
if flagsOK {
// Parse flags/envvars.
flagsOK := false
rt.Flags, flagsOK = env.ParseFlags()
if !flagsOK {
os.Exit(0)
}
bootOK := boot.InitRuntime(&rt, &s)
if bootOK {
// runtime.Log = runtime.Log.SetDB(runtime.Db)
}