Skip to content

Commit

Permalink
Merge pull request #17 from theopenlane/remove-cache-pkg
Browse files Browse the repository at this point in the history
remove cache pkg, upgrade utils
  • Loading branch information
golanglemonade authored Aug 29, 2024
2 parents babfa4c + 156c0a2 commit e93b126
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 146 deletions.
3 changes: 2 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
dbx "github.com/theopenlane/dbx/pkg/dbxclient"
"github.com/theopenlane/iam/fgax"

"github.com/theopenlane/utils/cache"

ent "github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/entdb"
"github.com/theopenlane/core/internal/httpserve/authmanager"
"github.com/theopenlane/core/internal/httpserve/config"
"github.com/theopenlane/core/internal/httpserve/server"
"github.com/theopenlane/core/internal/httpserve/serveropts"
"github.com/theopenlane/core/pkg/cache"
)

var serveCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import (
"github.com/theopenlane/iam/sessions"
"github.com/theopenlane/iam/tokens"

"github.com/theopenlane/utils/cache"

"github.com/theopenlane/core/internal/ent/entconfig"
"github.com/theopenlane/core/internal/httpserve/handlers"
"github.com/theopenlane/core/pkg/analytics/posthog"
"github.com/theopenlane/core/pkg/cache"
"github.com/theopenlane/core/pkg/events/kafka/kafkaconfig"
"github.com/theopenlane/core/pkg/middleware/cachecontrol"
"github.com/theopenlane/core/pkg/middleware/cors"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ require (
github.com/theopenlane/gqlgen-plugins v0.1.0
github.com/theopenlane/httpsling v0.1.0
github.com/theopenlane/iam v0.1.6
github.com/theopenlane/utils v0.1.4
github.com/theopenlane/utils v0.1.5
github.com/tursodatabase/libsql-client-go v0.0.0-20240812094001-348a4e45b535
github.com/vektah/gqlparser/v2 v2.5.16
github.com/wundergraph/graphql-go-tools v1.67.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ github.com/theopenlane/httpsling v0.1.0 h1:IHWUSo213stJTmHOHjNIg5b3npgpchzMdPMY7
github.com/theopenlane/httpsling v0.1.0/go.mod h1:wOyNfO4moIbmP4stQc9Kasgp+Q4sODo3LOLwvjUe/PA=
github.com/theopenlane/iam v0.1.6 h1:ps6xLXHpnGy687uLPRZiD7034DRVqaWEfJLCJVMx95o=
github.com/theopenlane/iam v0.1.6/go.mod h1:mOtYjuqUD7SX4EkwXFAYwf8+mwPDsRvTsLhAngqVIxM=
github.com/theopenlane/utils v0.1.4 h1:G2hrRBOugS2VvdqumBMrp2uSjulwbJMt8QO0EpwKm7g=
github.com/theopenlane/utils v0.1.4/go.mod h1:aFHkhJKNMGcaqNSfWV+hClZeejjuz4+oerrM7orq0Jw=
github.com/theopenlane/utils v0.1.5 h1:4DRieQmsBF87n4lPjEkTt6s4iVRQaCGYlk2+C05lt3o=
github.com/theopenlane/utils v0.1.5/go.mod h1:LWJzG9FfklsLlqWx/VdmfBMuNk700cWqHAwQL0299FM=
github.com/tursodatabase/libsql-client-go v0.0.0-20240812094001-348a4e45b535 h1:iLjJLq2A5J6L9zrhyNn+fpmxFvtEpYB4XLMr0rX3epI=
github.com/tursodatabase/libsql-client-go v0.0.0-20240812094001-348a4e45b535/go.mod h1:l8xTsYB90uaVdMHXMCxKKLSgw5wLYBwBKKefNIUnm9s=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
Expand Down
3 changes: 2 additions & 1 deletion internal/ent/hooks/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import (

"github.com/theopenlane/iam/auth"

"github.com/theopenlane/utils/passwd"

"github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/ent/generated/hook"
"github.com/theopenlane/core/internal/ent/generated/organization"
"github.com/theopenlane/core/internal/ent/generated/privacy"
"github.com/theopenlane/core/pkg/enums"
"github.com/theopenlane/utils/passwd"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion internal/httpserve/handlers/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (

"github.com/theopenlane/iam/auth"

"github.com/theopenlane/utils/passwd"

"github.com/theopenlane/core/pkg/enums"
"github.com/theopenlane/core/pkg/models"
"github.com/theopenlane/utils/passwd"
)

// LoginHandler validates the user credentials and returns a valid cookie
Expand Down
3 changes: 2 additions & 1 deletion internal/httpserve/handlers/resetpassword.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (
"github.com/theopenlane/iam/auth"
"github.com/theopenlane/iam/tokens"

"github.com/theopenlane/utils/passwd"

"github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/ent/privacy/token"
"github.com/theopenlane/core/pkg/models"
"github.com/theopenlane/utils/passwd"
)

// ResetPassword allows the user (after requesting a password reset) to
Expand Down
3 changes: 2 additions & 1 deletion internal/httpserve/serveropts/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ import (
"github.com/theopenlane/iam/sessions"
"github.com/theopenlane/iam/tokens"

"github.com/theopenlane/utils/cache"

"github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/graphapi"
"github.com/theopenlane/core/internal/httpserve/config"
"github.com/theopenlane/core/internal/httpserve/server"
"github.com/theopenlane/core/pkg/analytics"
"github.com/theopenlane/core/pkg/cache"
"github.com/theopenlane/core/pkg/events/kafka/publisher"
authmw "github.com/theopenlane/core/pkg/middleware/auth"
"github.com/theopenlane/core/pkg/middleware/cachecontrol"
Expand Down
31 changes: 14 additions & 17 deletions jsonschema/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Config contains the configuration for the core server
|[**authz**](#authz)|`object`||yes|
|[**db**](#db)|`object`||yes|
|[**dbx**](#dbx)|`object`|||
|[**redis**](#redis)|`object`|Config for the redis client used to store key-value pairs<br/>||
|[**redis**](#redis)|`object`|||
|[**tracer**](#tracer)|`object`|||
|[**email**](#email)|`object`|||
|[**sessions**](#sessions)|`object`|||
Expand Down Expand Up @@ -429,26 +429,23 @@ OauthProviderConfig represents the configuration for OAuth providers such as Git
<a name="redis"></a>
## redis: object

Config for the redis client used to store key-value pairs


**Properties**

|Name|Type|Description|Required|
|----|----|-----------|--------|
|**enabled**|`boolean`|Enabled to enable redis client in the server<br/>||
|**address**|`string`|Address is the host:port to connect to redis<br/>||
|**name**|`string`|Name of the connecting client<br/>||
|**username**|`string`|Username to connect to redis<br/>||
|**password**|`string`|Password, must match the password specified in the server configuration<br/>||
|**db**|`integer`|DB to be selected after connecting to the server, 0 uses the default<br/>||
|**dialTimeout**|`integer`|Dial timeout for establishing new connections, defaults to 5s<br/>||
|**readTimeout**|`integer`|Timeout for socket reads. If reached, commands will fail<br/>with a timeout instead of blocking. Supported values:<br/> - `0` - default timeout (3 seconds).<br/> - `-1` - no timeout (block indefinitely).<br/> - `-2` - disables SetReadDeadline calls completely.<br/>||
|**writeTimeout**|`integer`|Timeout for socket writes. If reached, commands will fail<br/>with a timeout instead of blocking. Supported values:<br/> - `0` - default timeout (3 seconds).<br/> - `-1` - no timeout (block indefinitely).<br/> - `-2` - disables SetWriteDeadline calls completely.<br/>||
|**maxRetries**|`integer`|MaxRetries before giving up.<br/>Default is 3 retries; -1 (not 0) disables retries.<br/>||
|**minIdleConns**|`integer`|MinIdleConns is useful when establishing new connection is slow.<br/>Default is 0. the idle connections are not closed by default.<br/>||
|**maxIdleConns**|`integer`|Maximum number of idle connections.<br/>Default is 0. the idle connections are not closed by default.<br/>||
|**maxActiveConns**|`integer`|Maximum number of connections allocated by the pool at a given time.<br/>When zero, there is no limit on the number of connections in the pool.<br/>||
|**enabled**|`boolean`|||
|**address**|`string`|||
|**name**|`string`|||
|**username**|`string`|||
|**password**|`string`|||
|**db**|`integer`|||
|**dialTimeout**|`integer`|||
|**readTimeout**|`integer`|||
|**writeTimeout**|`integer`|||
|**maxRetries**|`integer`|||
|**minIdleConns**|`integer`|||
|**maxIdleConns**|`integer`|||
|**maxActiveConns**|`integer`|||

**Additional Properties:** not allowed
<a name="tracer"></a>
Expand Down
42 changes: 14 additions & 28 deletions jsonschema/core.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,47 @@
"cache.Config": {
"properties": {
"enabled": {
"type": "boolean",
"description": "Enabled to enable redis client in the server"
"type": "boolean"
},
"address": {
"type": "string",
"description": "Address is the host:port to connect to redis"
"type": "string"
},
"name": {
"type": "string",
"description": "Name of the connecting client"
"type": "string"
},
"username": {
"type": "string",
"description": "Username to connect to redis"
"type": "string"
},
"password": {
"type": "string",
"description": "Password, must match the password specified in the server configuration"
"type": "string"
},
"db": {
"type": "integer",
"description": "DB to be selected after connecting to the server, 0 uses the default"
"type": "integer"
},
"dialTimeout": {
"type": "integer",
"description": "Dial timeout for establishing new connections, defaults to 5s"
"type": "integer"
},
"readTimeout": {
"type": "integer",
"description": "Timeout for socket reads. If reached, commands will fail\nwith a timeout instead of blocking. Supported values:\n - `0` - default timeout (3 seconds).\n - `-1` - no timeout (block indefinitely).\n - `-2` - disables SetReadDeadline calls completely."
"type": "integer"
},
"writeTimeout": {
"type": "integer",
"description": "Timeout for socket writes. If reached, commands will fail\nwith a timeout instead of blocking. Supported values:\n - `0` - default timeout (3 seconds).\n - `-1` - no timeout (block indefinitely).\n - `-2` - disables SetWriteDeadline calls completely."
"type": "integer"
},
"maxRetries": {
"type": "integer",
"description": "MaxRetries before giving up.\nDefault is 3 retries; -1 (not 0) disables retries."
"type": "integer"
},
"minIdleConns": {
"type": "integer",
"description": "MinIdleConns is useful when establishing new connection is slow.\nDefault is 0. the idle connections are not closed by default."
"type": "integer"
},
"maxIdleConns": {
"type": "integer",
"description": "Maximum number of idle connections.\nDefault is 0. the idle connections are not closed by default."
"type": "integer"
},
"maxActiveConns": {
"type": "integer",
"description": "Maximum number of connections allocated by the pool at a given time.\nWhen zero, there is no limit on the number of connections in the pool."
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"description": "Config for the redis client used to store key-value pairs"
"type": "object"
},
"cachecontrol.Config": {
"properties": {
Expand Down
1 change: 0 additions & 1 deletion jsonschema/schema_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
// any external packages must use the jsonschema description tags to add comments
var includedPackages = []string{
"./config",
"./pkg/cache",
"./internal/ent",
"./internal/entdb",
"./internal/httpserve/handlers",
Expand Down
89 changes: 0 additions & 89 deletions pkg/cache/client.go

This file was deleted.

2 changes: 0 additions & 2 deletions pkg/cache/doc.go

This file was deleted.

0 comments on commit e93b126

Please sign in to comment.