Upgrade v1.5.0

1. Add FileStorage Module;
This commit is contained in:
Bowens
2022-11-22 22:42:58 +08:00
parent eb9a06e478
commit fcdf5517b3
12 changed files with 166 additions and 102 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/goravel/framework/database"
"github.com/goravel/framework/event"
"github.com/goravel/framework/facades"
"github.com/goravel/framework/filesystem"
"github.com/goravel/framework/grpc"
"github.com/goravel/framework/http"
"github.com/goravel/framework/log"
@@ -25,42 +26,47 @@ func Boot() {}
func init() {
config := facades.Config
config.Add("app", map[string]interface{}{
//Application Name
//This value is the name of your application. This value is used when the
//framework needs to place the application's name in a notification or
//any other location as required by the application or its packages.
// Application Name
//
// This value is the name of your application. This value is used when the
// framework needs to place the application's name in a notification or
// any other location as required by the application or its packages.
"name": config.Env("APP_NAME", "Goravel"),
//Application Environment
//This value determines the "environment" your application is currently
//running in. This may determine how you prefer to configure various
//services the application utilizes. Set this in your ".env" file.
// Application Environment
//
// This value determines the "environment" your application is currently
// running in. This may determine how you prefer to configure various
// services the application utilizes. Set this in your ".env" file.
"env": config.Env("APP_ENV", "production"),
//Application Debug Mode
// Application Debug Mode
"debug": config.Env("APP_DEBUG", false),
//Application Timezone
//Here you may specify the default timezone for your application, which
//will be used by the PHP date and date-time functions. We have gone
//ahead and set this to a sensible default for you out of the box.
// Application Timezone
//
// Here you may specify the default timezone for your application, which
// will be used by the PHP date and date-time functions. We have gone
// ahead and set this to a sensible default for you out of the box.
"timezone": "UTC",
//Encryption Key
//32 character string, otherwise these encrypted strings
//will not be safe. Please do this before deploying an application!
// Encryption Key
//
// 32 character string, otherwise these encrypted strings
// will not be safe. Please do this before deploying an application!
"key": config.Env("APP_KEY", ""),
//Application URL
// Application URL
"url": config.Env("APP_URL", "http://localhost"),
//Application host, http server listening address.
// Application host, http server listening address.
"host": config.Env("APP_HOST", "127.0.0.1:3000"),
//Autoload service providers
//The service providers listed here will be automatically loaded on the
//request to your application. Feel free to add your own services to
//this array to grant expanded functionality to your applications.
// Autoload service providers
//
// The service providers listed here will be automatically loaded on the
// request to your application. Feel free to add your own services to
// this array to grant expanded functionality to your applications.
"providers": []contracts.ServiceProvider{
&log.ServiceProvider{},
&console.ServiceProvider{},
@@ -74,6 +80,7 @@ func init() {
&grpc.ServiceProvider{},
&mail.ServiceProvider{},
&auth.ServiceProvider{},
&filesystem.ServiceProvider{},
&providers.AppServiceProvider{},
&providers.RouteServiceProvider{},
&providers.GrpcServiceProvider{},

View File

@@ -7,26 +7,26 @@ import (
func init() {
config := facades.Config
config.Add("auth", map[string]interface{}{
//Authentication Defaults
// Authentication Defaults
//
//This option controls the default authentication "guard"
//reset options for your application. You may change these defaults
//as required, but they're a perfect start for most applications.
// This option controls the default authentication "guard"
// reset options for your application. You may change these defaults
// as required, but they're a perfect start for most applications.
"defaults": map[string]interface{}{
"guard": "user",
},
//Authentication Guards
// Authentication Guards
//
//Next, you may define every authentication guard for your application.
//Of course, a great default configuration has been defined for you
//here which uses session storage and the Eloquent user provider.
// Next, you may define every authentication guard for your application.
// Of course, a great default configuration has been defined for you
// here which uses session storage and the Eloquent user provider.
//
//All authentication drivers have a user provider. This defines how the
//users are actually retrieved out of your database or other storage
//mechanisms used by this application to persist your user's data.
// All authentication drivers have a user provider. This defines how the
// users are actually retrieved out of your database or other storage
// mechanisms used by this application to persist your user's data.
//
//Supported: "jwt"
// Supported: "jwt"
"guards": map[string]interface{}{
"user": map[string]interface{}{
"driver": "jwt",

View File

@@ -7,17 +7,19 @@ import (
func init() {
config := facades.Config
config.Add("cache", map[string]interface{}{
//Default Cache Store
//This option controls the default cache connection that gets used while
//using this caching library. This connection is used when another is
//not explicitly specified when executing a given caching function.
// Default Cache Store
//
// This option controls the default cache connection that gets used while
// using this caching library. This connection is used when another is
// not explicitly specified when executing a given caching function.
"default": config.Env("CACHE_STORE", "redis"),
//Cache Stores
//Here you may define all the cache "stores" for your application as
//well as their drivers. You may even define multiple stores for the
//same cache driver to group types of items stored in your caches.
//Available Drivers: "redis", "custom"
// Cache Stores
//
// Here you may define all the cache "stores" for your application as
// well as their drivers. You may even define multiple stores for the
// same cache driver to group types of items stored in your caches.
// Available Drivers: "redis", "custom"
"stores": map[string]interface{}{
"redis": map[string]interface{}{
"driver": "redis",
@@ -25,11 +27,12 @@ func init() {
},
},
//Cache Key Prefix
//When utilizing a RAM based store such as APC or Memcached, there might
//be other applications utilizing the same cache. So, we'll specify a
//value to get prefixed to all our keys, so we can avoid collisions.
//Must: a-zA-Z0-9_-
// Cache Key Prefix
//
// When utilizing a RAM based store such as APC or Memcached, there might
// be other applications utilizing the same cache. So, we'll specify a
// value to get prefixed to all our keys, so we can avoid collisions.
// Must: a-zA-Z0-9_-
"prefix": "goravel_cache",
})
}

View File

@@ -7,13 +7,13 @@ import (
func init() {
config := facades.Config
config.Add("cors", map[string]interface{}{
//Cross-Origin Resource Sharing (CORS) Configuration
// Cross-Origin Resource Sharing (CORS) Configuration
//
//Here you may configure your settings for cross-origin resource sharing
//or "CORS". This determines what cross-origin operations may execute
//in web browsers. You are free to adjust these settings as needed.
// Here you may configure your settings for cross-origin resource sharing
// or "CORS". This determines what cross-origin operations may execute
// in web browsers. You are free to adjust these settings as needed.
//
//To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
// To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
"allowed_methods": []string{"*"},
"allowed_origins": []string{"*"},
"allowed_headers": []string{"*"},

View File

@@ -7,10 +7,10 @@ import (
func init() {
config := facades.Config
config.Add("database", map[string]interface{}{
//Default database connection name, only support Mysql now.
// Default database connection name, only support Mysql now.
"default": config.Env("DB_CONNECTION", "mysql"),
//Database connections
// Database connections
"connections": map[string]interface{}{
"mysql": map[string]interface{}{
"driver": "mysql",
@@ -47,16 +47,18 @@ func init() {
},
},
//Migration Repository Table
//This table keeps track of all the migrations that have already run for
//your application. Using this information, we can determine which of
//the migrations on disk haven't actually been run in the database.
// Migration Repository Table
//
// This table keeps track of all the migrations that have already run for
// your application. Using this information, we can determine which of
// the migrations on disk haven't actually been run in the database.
"migrations": "migrations",
//Redis Databases
//Redis is an open source, fast, and advanced key-value store that also
//provides a richer body of commands than a typical key-value system
//such as APC or Memcached.
// Redis Databases
//
// Redis is an open source, fast, and advanced key-value store that also
// provides a richer body of commands than a typical key-value system
// such as APC or Memcached.
"redis": map[string]interface{}{
"default": map[string]interface{}{
"host": config.Env("REDIS_HOST", ""),

55
config/filesystems.go Normal file
View File

@@ -0,0 +1,55 @@
package config
import (
"github.com/goravel/framework/facades"
)
func init() {
config := facades.Config
config.Add("filesystems", map[string]any{
// Default Filesystem Disk
//
// Here you may specify the default filesystem disk that should be used
// by the framework. The "local" disk, as well as a variety of cloud
// based disks are available to your application. Just store away!
"default": config.Env("FILESYSTEM_DISK", "local"),
// Filesystem Disks
//
// Here you may configure as many filesystem "disks" as you wish, and you
// may even configure multiple disks of the same driver. Defaults have
// been set up for each driver as an example of the required values.
//
// Supported Drivers: "local", "s3", "oss", "cos", "custom"
"disks": map[string]any{
"local": map[string]any{
"driver": "local",
"root": "storage/app",
"url": config.Env("APP_URL").(string) + "/storage",
},
"s3": map[string]any{
"driver": "s3",
"key": config.Env("AWS_ACCESS_KEY_ID"),
"secret": config.Env("AWS_ACCESS_KEY_SECRET"),
"region": config.Env("AWS_DEFAULT_REGION"),
"bucket": config.Env("AWS_BUCKET"),
"url": config.Env("AWS_URL"),
},
"oss": map[string]any{
"driver": "oss",
"key": config.Env("ALIYUN_ACCESS_KEY_ID"),
"secret": config.Env("ALIYUN_ACCESS_KEY_SECRET"),
"bucket": config.Env("ALIYUN_BUCKET"),
"url": config.Env("ALIYUN_URL"),
"endpoint": config.Env("ALIYUN_ENDPOINT"),
},
"cos": map[string]any{
"driver": "cos",
"key": config.Env("TENCENT_ACCESS_KEY_ID"),
"secret": config.Env("TENCENT_ACCESS_KEY_SECRET"),
"bucket": config.Env("TENCENT_BUCKET"),
"url": config.Env("TENCENT_URL"),
},
},
})
}

View File

@@ -7,35 +7,35 @@ import (
func init() {
config := facades.Config
config.Add("jwt", map[string]interface{}{
//JWT Authentication Secret
// JWT Authentication Secret
//
//Don't forget to set this in your .env file, as it will be used to sign
//your tokens. A helper command is provided for this:
//`go run . artisan jwt:secret`
// Don't forget to set this in your .env file, as it will be used to sign
// your tokens. A helper command is provided for this:
// `go run . artisan jwt:secret`
"secret": config.Env("JWT_SECRET", ""),
//JWT time to live
// JWT time to live
//
//Specify the length of time (in minutes) that the token will be valid for.
//Defaults to 1 hour.
// Specify the length of time (in minutes) that the token will be valid for.
// Defaults to 1 hour.
//
//You can also set this to 0, to yield a never expiring token.
//Some people may want this behaviour for e.g. a mobile app.
//This is not particularly recommended, so make sure you have appropriate
//systems in place to revoke the token if necessary.
// You can also set this to 0, to yield a never expiring token.
// Some people may want this behaviour for e.g. a mobile app.
// This is not particularly recommended, so make sure you have appropriate
// systems in place to revoke the token if necessary.
"ttl": config.Env("JWT_TTL", 60),
//Refresh time to live
// Refresh time to live
//
//Specify the length of time (in minutes) that the token can be refreshed
//within. I.E. The user can refresh their token within a 2 week window of
//the original token being created until they must re-authenticate.
//Defaults to 2 weeks.
// Specify the length of time (in minutes) that the token can be refreshed
// within. I.E. The user can refresh their token within a 2 week window of
// the original token being created until they must re-authenticate.
// Defaults to 2 weeks.
//
//You can also set this to null, to yield an infinite refresh time.
//Some may want this instead of never expiring tokens for e.g. a mobile app.
//This is not particularly recommended, so make sure you have appropriate
//systems in place to revoke the token if necessary.
// You can also set this to null, to yield an infinite refresh time.
// Some may want this instead of never expiring tokens for e.g. a mobile app.
// This is not particularly recommended, so make sure you have appropriate
// systems in place to revoke the token if necessary.
"refresh_ttl": config.Env("JWT_REFRESH_TTL", 20160),
})
}

View File

@@ -7,16 +7,18 @@ import (
func init() {
config := facades.Config
config.Add("logging", map[string]interface{}{
//Default Log Channel
//This option defines the default log channel that gets used when writing
//messages to the logs. The name specified in this option should match
//one of the channels defined in the "channels" configuration array.
// Default Log Channel
//
// This option defines the default log channel that gets used when writing
// messages to the logs. The name specified in this option should match
// one of the channels defined in the "channels" configuration array.
"default": config.Env("LOG_CHANNEL", "stack"),
//Log Channels
//Here you may configure the log channels for your application.
//Available Drivers: "single", "daily", "custom", "stack"
//Available Level: "debug", "info", "warning", "error", "fatal", "panic"
// Log Channels
//
// Here you may configure the log channels for your application.
// Available Drivers: "single", "daily", "custom", "stack"
// Available Level: "debug", "info", "warning", "error", "fatal", "panic"
"channels": map[string]interface{}{
"stack": map[string]interface{}{
"driver": "stack",

View File

@@ -5,18 +5,14 @@ import "github.com/goravel/framework/facades"
func init() {
config := facades.Config
facades.Config.Add("mail", map[string]interface{}{
// --------------------------------------------------------------------------
// SMTP Host Address
// --------------------------------------------------------------------------
//
// Here you may provide the host address of the SMTP server used by your
// applications. A default option is provided that is compatible with
// the Mailgun mail service which will provide reliable deliveries.
"host": config.Env("MAIL_HOST", ""),
// --------------------------------------------------------------------------
// SMTP Host Port
// --------------------------------------------------------------------------
//
// This is the SMTP port used by your application to deliver e-mails to
// users of the application. Like the host we have set this value to
@@ -35,9 +31,7 @@ func init() {
"name": config.Env("MAIL_FROM_NAME", "Example"),
},
// --------------------------------------------------------------------------
// SMTP Server Username
// --------------------------------------------------------------------------
//
// If your SMTP server requires a username for authentication, you should
// set it here. This will get used to authenticate with your server on

View File

@@ -7,12 +7,13 @@ import (
func init() {
config := facades.Config
config.Add("queue", map[string]interface{}{
//Default Queue Connection Name
// Default Queue Connection Name
"default": config.Env("QUEUE_CONNECTION", "sync"),
//Queue Connections
//Here you may configure the connection information for each server that is used by your application.
//Drivers: "sync", "redis"
// Queue Connections
//
// Here you may configure the connection information for each server that is used by your application.
// Drivers: "sync", "redis"
"connections": map[string]interface{}{
"sync": map[string]interface{}{
"driver": "sync",

2
go.mod
View File

@@ -2,7 +2,7 @@ module goravel
go 1.18
require github.com/goravel/framework v1.4.0
require github.com/goravel/framework v1.5.0
require (
cloud.google.com/go v0.100.2 // indirect

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 KiB