This repository has been archived by the owner on Mar 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic support for a couple server configs. Replacing dest.write with …
…writeFileFromString
- Loading branch information
Showing
2 changed files
with
69 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,50 @@ | ||
'use strict'; | ||
|
||
function configFilename(provider) { | ||
var request = require('request'); | ||
|
||
|
||
// TODO: support other providers | ||
var SERVER_CONFIG = { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
gae: { | ||
filename: 'app.yaml', | ||
url: 'https://raw.githubusercontent.com/h5bp/server-configs-gae/master/app.yaml' | ||
}, | ||
apache: { | ||
filename: '.htaccess', | ||
url: 'https://raw.githubusercontent.com/h5bp/server-configs-apache/master/dist/.htaccess' | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
} | ||
|
||
function fetchConfig(provider, callback) { | ||
|
||
function config(provider) { | ||
return SERVER_CONFIG[provider]; | ||
} | ||
|
||
function isSupported(provider) { | ||
return !!config(provider); | ||
} | ||
|
||
function fetchConfig(provider, callback) { | ||
var cfg = config(provider); | ||
if (!cfg) { | ||
callback(new Error('unknown provider: ' + provider)); | ||
return; | ||
} | ||
request(cfg.url, function(err, res, body) { | ||
if (!err && res.statusCode != 200) { | ||
err = new Error('config fetch error ' + res.statusCode); | ||
} | ||
callback(err, cfg, body); | ||
}); | ||
} | ||
|
||
function deployTaskFilename(provider, tool) { | ||
|
||
} | ||
|
||
module.exports = { | ||
configFilename: configFilename, | ||
config: config, | ||
isSupported: isSupported, | ||
fetchConfig: fetchConfig, | ||
deployTaskFilename: deployTaskFilename | ||
} |
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 seems like just copying the h5bp server configs. Why don't we just rely on composability and
generator-server-configs
? cc @sindresorhus