transloadit / uppy-server

[DEPRECATED] 'Uppy Server' was renamed to 'Companion' and lives inside the Uppy repo no
https://github.com/transloadit/uppy/tree/master/packages/%40uppy/companion
MIT License
114 stars 27 forks source link

config file ignored #99

Closed dohomi closed 6 years ago

dohomi commented 6 years ago

Hello,

I wanted to set up a standalone server based on the docs: package.json

"scripts":{
    "start": "node ./node_modules/uppy-server/lib/standalone/start-server.js --config ./config.json",
}

config.json:

{
  "UPPYSERVER_SECRET": "my-super-secret",
  "UPPYSERVER_DOMAIN": "https://uppy-server.mydomain.com,localhost:3020",
  "UPPYSERVER_DATADIR": "/mnt/server-data",
  "UPPYSERVER_PATH": "",
  "UPPYSERVER_PROTOCOL":"HTTPS",
  "UPPYSERVER_PORT": 3020
}

I only receive following error message (it seems that --config does not work?

uppy: 2018-07-05T08:47:06.788Z [warn] startup.secret auto-generating server secret because none was specified
 Please specify the following options to run uppy-server as Standalone:
 "filePath",
"server.host" 

Any idea what I am doing wrong? Thanks

dohomi commented 6 years ago

I used now an sh file to set the config but there seems to be no listen() on the standalone server. I am not sure if I misunderstand the concept but it will be great to show a standalone server example without cloning this repo. Thanks

ifedapoolarewaju commented 6 years ago

Hi @dohomi for the json config, the object should take the form here

It seems you are rather specifying options meant for the .sh config in .json

dohomi commented 6 years ago

@ifedapoolarewaju thanks for your answer. Do you have a working example of standalone server? The object you were referring has some functions which wont be available using as json. Are there any examples on a server setup - I've seen the lambda example but would like to deploy via zeit.co/now.

Referring the start-server.js inside of a start script seems not to work out of the box.

ifedapoolarewaju commented 6 years ago

@dohomi no function options are supported via the standalone server. You can merely pass the whole object as is. You can declare a json file like so:

{
  "providerOptions": {
    "google": {
      "key": "***",
      "secret": "***"
    },
    "s3": {
      "key": "***",
      "secret": "***",
      "bucket": "bucket-name",
      "region": "us-east-1"
    }
  },
  "server": {
    "host": "localhost:3020",
    "protocol": "http"
  },
  "filePath": "path/to/download/folder",
  "sendSelfEndpoint": "localhost:3020",
  "secret": "mysecret",
  "uploadUrls": ["https://myuploadurl.com", "http://myuploadurl2.com"]
  "debug": true
}

this should work for sure.

uppy client currently starts the standalone-server using env variables. See

dohomi commented 6 years ago

@ifedapoolarewaju thanks for your example 👍