Skip to content

Commit

Permalink
Deprecate uploaddir and replace it with datadir
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee committed Jan 29, 2017
1 parent de89d4c commit 11ee851
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pump.io follows [Semantic Versioning][semver].

## 2.2.0 - Future
## 3.0.0 - Future

### Improved

Expand All @@ -16,6 +16,10 @@ pump.io follows [Semantic Versioning][semver].

* Incorrect and unnecessary 'plugin-types' Content Security Policy directives are no longer sent

### Breaking

* The `uploaddir` option is obsolete and should be migrated to the new `datadir` option (#1272)

## 2.1.1 - 2017-01-18

### Fixed
Expand Down
9 changes: 9 additions & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ var makeApp = function(configBase, callback) {
hostname = config.hostname;
address = config.address || config.hostname;

// Throw on configs written for < 3.x

if (config.uploaddir) throw new Error("`uploaddir` is no longer supported; see the pump.io 3.x release notes");

if (config.uploadsEnabled) {
if (!config.datadir) throw new Error("Uploads enabled but no `datadir` specified");
config.uploaddir = path.join(config.datadir, "uploads");
}

if (process.getuid) {
if (port < 1024 && process.getuid() !== 0) {
callback(new Error("Can't listen to ports lower than 1024 on POSIX systems unless you're root."), null);
Expand Down
3 changes: 2 additions & 1 deletion lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module.exports = {driver: "memory",
key: null,
cert: null,
hsts: false,
uploaddir: null,
datadir: null,
uploadsEnabled: false,
debugClient: false,
firehose: "ofirehose.com",
spamhost: null,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pump.io",
"preferGlobal": "true",
"homepage": "http://pump.io/",
"version": "2.2.0-alpha.0",
"version": "3.0.0-alpha.0",
"author": "Evan Prodromou <evan@e14n.com>",
"devDependencies": {
"jscs": "^3.0.3",
Expand Down
4 changes: 2 additions & 2 deletions test/upload-file-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ suite.addBatch({
dirname = path.join(os.tmpDir(),
"upload-file-test",
""+Date.now());
mkdirp(dirname, function(err) {
mkdirp(path.join(dirname, "uploads"), function(err) {
if (err) {
callback(err, null);
} else {
Expand All @@ -73,7 +73,7 @@ suite.addBatch({
},
"and we set up the app": {
topic: function(dir) {
setupAppConfig({uploaddir: dir},
setupAppConfig({datadir: dir, uploadsEnabled: true},
this.callback);
},
teardown: function(app) {
Expand Down

0 comments on commit 11ee851

Please sign in to comment.