Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F12339849
config.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
config.go
View Options
/*
* Copyright © 2020-2021 Musing Studio LLC.
*
* This file is part of WriteFreely.
*
* WriteFreely is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, included
* in the LICENSE file in this source code package.
*/
package
main
import
(
"github.com/urfave/cli/v2"
"github.com/writefreely/writefreely"
)
var
(
cmdConfig
cli
.
Command
=
cli
.
Command
{
Name
:
"config"
,
Usage
:
"config management tools"
,
Subcommands
:
[]
*
cli
.
Command
{
&
cmdConfigGenerate
,
&
cmdConfigInteractive
,
},
}
cmdConfigGenerate
cli
.
Command
=
cli
.
Command
{
Name
:
"generate"
,
Aliases
:
[]
string
{
"gen"
},
Usage
:
"Generate a basic configuration"
,
Action
:
genConfigAction
,
}
cmdConfigInteractive
cli
.
Command
=
cli
.
Command
{
Name
:
"start"
,
Usage
:
"Interactive configuration process"
,
Action
:
interactiveConfigAction
,
Flags
:
[]
cli
.
Flag
{
&
cli
.
StringFlag
{
Name
:
"sections"
,
Value
:
"server db app"
,
Usage
:
"Which sections of the configuration to go through\n"
+
"valid values of sections flag are any combination of 'server', 'db' and 'app' \n"
+
"example: writefreely config start --sections \"db app\""
,
},
},
}
)
func
genConfigAction
(
c
*
cli
.
Context
)
error
{
app
:=
writefreely
.
NewApp
(
c
.
String
(
"c"
))
return
writefreely
.
CreateConfig
(
app
)
}
func
interactiveConfigAction
(
c
*
cli
.
Context
)
error
{
app
:=
writefreely
.
NewApp
(
c
.
String
(
"c"
))
writefreely
.
DoConfig
(
app
,
c
.
String
(
"sections"
))
return
nil
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 15, 10:34 AM (14 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3479176
Attached To
rWF WriteFreely
Event Timeline
Log In to Comment