Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
10c57167
Commit
10c57167
authored
May 02, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove unused flags
parent
5742f9ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
28 deletions
+5
-28
main.go
bin/memos/main.go
+1
-16
profile.go
server/profile/profile.go
+0
-4
server.go
server/server.go
+2
-5
.env.example
web/.env.example
+0
-1
grpcweb.ts
web/src/grpcweb.ts
+1
-1
resource.ts
web/src/utils/resource.ts
+1
-1
No files found.
bin/memos/main.go
View file @
10c57167
...
@@ -36,8 +36,6 @@ var (
...
@@ -36,8 +36,6 @@ var (
data
string
data
string
driver
string
driver
string
dsn
string
dsn
string
serveFrontend
bool
allowedOrigins
[]
string
instanceProfile
*
profile
.
Profile
instanceProfile
*
profile
.
Profile
rootCmd
=
&
cobra
.
Command
{
rootCmd
=
&
cobra
.
Command
{
...
@@ -111,8 +109,6 @@ func init() {
...
@@ -111,8 +109,6 @@ func init() {
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
data
,
"data"
,
"d"
,
""
,
"data directory"
)
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
data
,
"data"
,
"d"
,
""
,
"data directory"
)
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
driver
,
"driver"
,
""
,
""
,
"database driver"
)
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
driver
,
"driver"
,
""
,
""
,
"database driver"
)
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
dsn
,
"dsn"
,
""
,
""
,
"database source name(aka. DSN)"
)
rootCmd
.
PersistentFlags
()
.
StringVarP
(
&
dsn
,
"dsn"
,
""
,
""
,
"database source name(aka. DSN)"
)
rootCmd
.
PersistentFlags
()
.
BoolVarP
(
&
serveFrontend
,
"frontend"
,
""
,
true
,
"serve frontend files"
)
rootCmd
.
PersistentFlags
()
.
StringArrayVarP
(
&
allowedOrigins
,
"origins"
,
""
,
[]
string
{},
"CORS allowed domain origins"
)
err
:=
viper
.
BindPFlag
(
"mode"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"mode"
))
err
:=
viper
.
BindPFlag
(
"mode"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"mode"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -138,21 +134,11 @@ func init() {
...
@@ -138,21 +134,11 @@ func init() {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
err
=
viper
.
BindPFlag
(
"frontend"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"frontend"
))
if
err
!=
nil
{
panic
(
err
)
}
err
=
viper
.
BindPFlag
(
"origins"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"origins"
))
if
err
!=
nil
{
panic
(
err
)
}
viper
.
SetDefault
(
"mode"
,
"demo"
)
viper
.
SetDefault
(
"mode"
,
"demo"
)
viper
.
SetDefault
(
"driver"
,
"sqlite"
)
viper
.
SetDefault
(
"driver"
,
"sqlite"
)
viper
.
SetDefault
(
"addr"
,
""
)
viper
.
SetDefault
(
"addr"
,
""
)
viper
.
SetDefault
(
"port"
,
8081
)
viper
.
SetDefault
(
"port"
,
8081
)
viper
.
SetDefault
(
"frontend"
,
true
)
viper
.
SetDefault
(
"origins"
,
[]
string
{})
viper
.
SetEnvPrefix
(
"memos"
)
viper
.
SetEnvPrefix
(
"memos"
)
}
}
...
@@ -174,9 +160,8 @@ addr: %s
...
@@ -174,9 +160,8 @@ addr: %s
port: %d
port: %d
mode: %s
mode: %s
driver: %s
driver: %s
frontend: %t
---
---
`
,
instanceProfile
.
Version
,
instanceProfile
.
Data
,
instanceProfile
.
DSN
,
instanceProfile
.
Addr
,
instanceProfile
.
Port
,
instanceProfile
.
Mode
,
instanceProfile
.
Driver
,
instanceProfile
.
Frontend
)
`
,
instanceProfile
.
Version
,
instanceProfile
.
Data
,
instanceProfile
.
DSN
,
instanceProfile
.
Addr
,
instanceProfile
.
Port
,
instanceProfile
.
Mode
,
instanceProfile
.
Driver
)
}
}
func
printGreetings
()
{
func
printGreetings
()
{
...
...
server/profile/profile.go
View file @
10c57167
...
@@ -30,10 +30,6 @@ type Profile struct {
...
@@ -30,10 +30,6 @@ type Profile struct {
Driver
string
`json:"-"`
Driver
string
`json:"-"`
// Version is the current version of server
// Version is the current version of server
Version
string
`json:"version"`
Version
string
`json:"version"`
// Frontend indicate the frontend is enabled or not
Frontend
bool
`json:"-"`
// Origins is the list of allowed origins
Origins
[]
string
`json:"-"`
}
}
func
(
p
*
Profile
)
IsDev
()
bool
{
func
(
p
*
Profile
)
IsDev
()
bool
{
...
...
server/server.go
View file @
10c57167
...
@@ -61,11 +61,8 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
...
@@ -61,11 +61,8 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
return
c
.
String
(
http
.
StatusOK
,
"Service ready."
)
return
c
.
String
(
http
.
StatusOK
,
"Service ready."
)
})
})
// Only serve frontend when it's enabled.
// Serve frontend resources.
if
profile
.
Frontend
{
frontend
.
NewFrontendService
(
profile
,
store
)
.
Serve
(
ctx
,
echoServer
)
frontendService
:=
frontend
.
NewFrontendService
(
profile
,
store
)
frontendService
.
Serve
(
ctx
,
echoServer
)
}
rootGroup
:=
echoServer
.
Group
(
""
)
rootGroup
:=
echoServer
.
Group
(
""
)
...
...
web/.env.example
deleted
100644 → 0
View file @
5742f9ca
VITE_API_BASE_URL=http://localhost:8081
web/src/grpcweb.ts
View file @
10c57167
...
@@ -13,7 +13,7 @@ import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_servi
...
@@ -13,7 +13,7 @@ import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_servi
import
{
WorkspaceSettingServiceDefinition
}
from
"./types/proto/api/v1/workspace_setting_service"
;
import
{
WorkspaceSettingServiceDefinition
}
from
"./types/proto/api/v1/workspace_setting_service"
;
const
channel
=
createChannel
(
const
channel
=
createChannel
(
import
.
meta
.
env
.
VITE_API_BASE_URL
||
window
.
location
.
origin
,
window
.
location
.
origin
,
FetchTransport
({
FetchTransport
({
credentials
:
"include"
,
credentials
:
"include"
,
}),
}),
...
...
web/src/utils/resource.ts
View file @
10c57167
...
@@ -5,7 +5,7 @@ export const getResourceUrl = (resource: Resource) => {
...
@@ -5,7 +5,7 @@ export const getResourceUrl = (resource: Resource) => {
return
resource
.
externalLink
;
return
resource
.
externalLink
;
}
}
return
`
${
import
.
meta
.
env
.
VITE_API_BASE_URL
||
window
.
location
.
origin
}
/file/
${
resource
.
name
}
`
;
return
`
${
window
.
location
.
origin
}
/file/
${
resource
.
name
}
`
;
};
};
export
const
getResourceType
=
(
resource
:
Resource
)
=>
{
export
const
getResourceType
=
(
resource
:
Resource
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment