Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parametrizing app by its location (host's URL)
Used for authorization re-directs.
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// license: AGPL | ||
// (c) MLstate, 2011, 2012 | ||
// author: Adam Koprowski | ||
|
||
database string /host | ||
|
||
module Config { | ||
|
||
// TODO: abstract away this pattern | ||
server host = | ||
_ = CommandLine.filter( | ||
{ init: void | ||
, parsers: [{ CommandLine.default_parser with | ||
names: ["--host"], | ||
param_doc: "HOST", | ||
description: "Sets the address of the application (needed for all redirects)", | ||
function on_param(state) { | ||
parser host=(.*) -> | ||
{ | ||
/host <- Text.to_string(host) | ||
{no_params: state} | ||
} | ||
} | ||
}] | ||
, anonymous: [] | ||
, title: "General options" | ||
} | ||
) | ||
match (?/host) { | ||
case {some: host}: host | ||
default: | ||
Log.error("webshell[config]", "Cannot read host configuration | ||
Please re-run your application with: --host option") | ||
System.exit(1) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters