Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
m-team
oidc
mytoken
server
Commits
95d7b6e8
Commit
95d7b6e8
authored
4 years ago
by
Gabriel Zachmann
Browse files
Options
Downloads
Patches
Plain Diff
improve setup output
parent
8fff6d55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/mytoken-server/mytoken-setup/setup.go
+15
-5
15 additions, 5 deletions
cmd/mytoken-server/mytoken-setup/setup.go
with
15 additions
and
5 deletions
cmd/mytoken-server/mytoken-setup/setup.go
+
15
−
5
View file @
95d7b6e8
...
@@ -66,7 +66,13 @@ func (c *commandInstallGeoIPDB) Execute(args []string) error {
...
@@ -66,7 +66,13 @@ func (c *commandInstallGeoIPDB) Execute(args []string) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
return
ioutil
.
WriteFile
(
config
.
Get
()
.
GeoIPDBFile
,
archive
[
"IP2LOCATION-LITE-DB1.IPV6.BIN"
],
0644
)
log
.
Debug
(
"Downloaded zip file"
)
err
=
ioutil
.
WriteFile
(
config
.
Get
()
.
GeoIPDBFile
,
archive
[
"IP2LOCATION-LITE-DB1.IPV6.BIN"
],
0644
)
if
err
==
nil
{
log
.
WithField
(
"file"
,
config
.
Get
()
.
GeoIPDBFile
)
.
Debug
(
"Installed geo ip database"
)
fmt
.
Printf
(
"Installed geo ip database file to '%s'.
\n
"
,
config
.
Get
()
.
GeoIPDBFile
)
}
return
err
}
}
// Execute implements the flags.Commander interface
// Execute implements the flags.Commander interface
...
@@ -78,6 +84,7 @@ func (c *commandGenSigningKey) Execute(args []string) error {
...
@@ -78,6 +84,7 @@ func (c *commandGenSigningKey) Execute(args []string) error {
str
:=
jws
.
ExportPrivateKeyAsPemStr
(
sk
)
str
:=
jws
.
ExportPrivateKeyAsPemStr
(
sk
)
filepath
:=
config
.
Get
()
.
Signing
.
KeyFile
filepath
:=
config
.
Get
()
.
Signing
.
KeyFile
if
fileutil
.
FileExists
(
filepath
)
{
if
fileutil
.
FileExists
(
filepath
)
{
log
.
WithField
(
"filepath"
,
filepath
)
.
Debug
(
"File already exists"
)
if
!
prompter
.
YesNo
(
fmt
.
Sprintf
(
"File '%s' already exists. Do you want to overwrite it?"
,
filepath
),
false
)
{
if
!
prompter
.
YesNo
(
fmt
.
Sprintf
(
"File '%s' already exists. Do you want to overwrite it?"
,
filepath
),
false
)
{
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
...
@@ -85,7 +92,8 @@ func (c *commandGenSigningKey) Execute(args []string) error {
...
@@ -85,7 +92,8 @@ func (c *commandGenSigningKey) Execute(args []string) error {
if
err
=
ioutil
.
WriteFile
(
filepath
,
[]
byte
(
str
),
0600
);
err
!=
nil
{
if
err
=
ioutil
.
WriteFile
(
filepath
,
[]
byte
(
str
),
0600
);
err
!=
nil
{
return
err
return
err
}
}
log
.
WithField
(
"filepath"
,
filepath
)
.
Info
(
"Wrote key to file."
)
log
.
WithField
(
"filepath"
,
filepath
)
.
Debug
(
"Wrote key to file"
)
fmt
.
Printf
(
"Wrote key to file '%s'.
\n
"
,
filepath
)
return
nil
return
nil
}
}
...
@@ -95,8 +103,6 @@ func (c *commandCreateDB) Execute(args []string) error {
...
@@ -95,8 +103,6 @@ func (c *commandCreateDB) Execute(args []string) error {
if
c
.
Password
!=
nil
&&
len
(
*
c
.
Password
)
==
0
{
// -p specified without argument
if
c
.
Password
!=
nil
&&
len
(
*
c
.
Password
)
==
0
{
// -p specified without argument
password
=
prompter
.
Password
(
"Database Password"
)
password
=
prompter
.
Password
(
"Database Password"
)
}
}
fmt
.
Printf
(
"%s:%s
\n
"
,
c
.
Username
,
password
)
os
.
Exit
(
0
)
dsn
:=
fmt
.
Sprintf
(
"%s:%s@%s(%s)/"
,
c
.
Username
,
password
,
"tcp"
,
config
.
Get
()
.
DB
.
Host
)
dsn
:=
fmt
.
Sprintf
(
"%s:%s@%s(%s)/"
,
c
.
Username
,
password
,
"tcp"
,
config
.
Get
()
.
DB
.
Host
)
if
err
:=
db
.
ConnectDSN
(
dsn
);
err
!=
nil
{
if
err
:=
db
.
ConnectDSN
(
dsn
);
err
!=
nil
{
return
err
return
err
...
@@ -105,7 +111,7 @@ func (c *commandCreateDB) Execute(args []string) error {
...
@@ -105,7 +111,7 @@ func (c *commandCreateDB) Execute(args []string) error {
if
err
:=
checkDB
();
err
!=
nil
{
if
err
:=
checkDB
();
err
!=
nil
{
return
err
return
err
}
}
return
db
.
Transact
(
func
(
tx
*
sqlx
.
Tx
)
error
{
err
:=
db
.
Transact
(
func
(
tx
*
sqlx
.
Tx
)
error
{
if
err
:=
createDB
(
tx
);
err
!=
nil
{
if
err
:=
createDB
(
tx
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -120,6 +126,10 @@ func (c *commandCreateDB) Execute(args []string) error {
...
@@ -120,6 +126,10 @@ func (c *commandCreateDB) Execute(args []string) error {
}
}
return
nil
return
nil
})
})
if
err
==
nil
{
fmt
.
Println
(
"Prepared database."
)
}
return
err
}
}
func
addPredefinedValues
(
tx
*
sqlx
.
Tx
)
error
{
func
addPredefinedValues
(
tx
*
sqlx
.
Tx
)
error
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment