Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
f8e2cc80
Commit
f8e2cc80
authored
Sep 08, 2015
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #234 from humboldtux/browse
core: Configuration as command line arg #222
parents
4e1717db
5d32af8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
main.go
main.go
+7
-1
No files found.
main.go
View file @
f8e2cc80
...
...
@@ -124,7 +124,7 @@ func isLocalhost(s string) bool {
// loadConfigs loads configuration from a file or stdin (piped).
// The configurations are grouped by bind address.
// Configuration is obtained from one of three sources, tried
// in this order: 1. -conf flag, 2. stdin, 3. Caddyfile.
// in this order: 1. -conf flag, 2. stdin, 3.
command line argument 4.
Caddyfile.
// If none of those are available, a default configuration is
// loaded.
func
loadConfigs
()
(
config
.
Group
,
error
)
{
...
...
@@ -155,6 +155,12 @@ func loadConfigs() (config.Group, error) {
}
}
// Command line Arg
if
flag
.
NArg
()
>
0
{
confBody
:=
":"
+
config
.
DefaultPort
+
"
\n
"
+
strings
.
Join
(
flag
.
Args
(),
"
\n
"
)
return
config
.
Load
(
"args"
,
bytes
.
NewBufferString
(
confBody
))
}
// Caddyfile
file
,
err
:=
os
.
Open
(
config
.
DefaultConfigFile
)
if
err
!=
nil
{
...
...
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