Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am unable to use json format to start parse-server #1358

Closed
gowridev opened this issue Apr 4, 2016 · 5 comments
Closed

I am unable to use json format to start parse-server #1358

gowridev opened this issue Apr 4, 2016 · 5 comments

Comments

@gowridev
Copy link

gowridev commented Apr 4, 2016

I am unable to use json format to start parse-server.

Execution log

parse-server GowriDev$ parse-server myConfig.json 
Configuation loaded from /Users/GowriDev/ParseWork/parse-server/myConfig.json

  Usage: parse-server [options] <path/to/configuration.json>

  Options:

    -h, --help                                             output usage information
    --appId <appId>                                        Your Parse Application ID
    --masterKey <masterKey>                                Your Parse Master Key
    --port [port]                                          The port to run the ParseServer. defaults to 1337.
    --databaseURI [databaseURI]                            The full URI to your mongodb database
    --serverURL [serverURL]                                URL to your parse server with http:// or https://.
    --clientKey [clientKey]                                Key for iOS, MacOS, tvOS clients
    --javascriptKey [javascriptKey]                        Key for the Javascript SDK
    --restAPIKey [restAPIKey]                              Key for REST calls
    --dotNetKey [dotNetKey]                                Key for Unity and .Net SDK
    --cloud [cloud]                                        Full path to your cloud code main.js
    --push [push]                                          Configuration for push, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Push
    --oauth [oauth]                                        Configuration for your oAuth providers, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#oauth
    --fileKey [fileKey]                                    Key for your files
    --facebookAppIds [facebookAppIds]                      Comma separated list for your facebook app Ids
    --enableAnonymousUsers [enableAnonymousUsers]          Enable (or disable) anon users, defaults to true
    --allowClientClassCreation [allowClientClassCreation]  Enable (or disable) client class creation, defaults to true
    --mountPath [mountPath]                                Mount path for the server, defaults to /parse
    --databaseAdapter [databaseAdapter]                    Adapter module for the database sub-system
    --filesAdapter [filesAdapter]                          Adapter module for the files sub-system
    --loggerAdapter [loggerAdapter]                        Adapter module for the logging sub-system
    --maxUploadSize [maxUploadSize]                        Max file size for uploads.

  Configure From Environment:

    $ PARSE_SERVER_APPLICATION_ID='appId'
    $ PARSE_SERVER_MASTER_KEY='masterKey'
    $ PORT='port'
    $ PARSE_SERVER_DATABASE_URI='databaseURI'
    $ PARSE_SERVER_URL='serverURL'
    $ PARSE_SERVER_CLIENT_KEY='clientKey'
    $ PARSE_SERVER_JAVASCRIPT_KEY='javascriptKey'
    $ PARSE_SERVER_REST_API_KEY='restAPIKey'
    $ PARSE_SERVER_DOT_NET_KEY='dotNetKey'
    $ PARSE_SERVER_CLOUD_CODE_MAIN='cloud'
    $ PARSE_SERVER_PUSH='push'
    $ PARSE_SERVER_OAUTH_PROVIDERS='oauth'
    $ PARSE_SERVER_FILE_KEY='fileKey'
    $ PARSE_SERVER_FACEBOOK_APP_IDS='facebookAppIds'
    $ PARSE_SERVER_ENABLE_ANON_USERS='enableAnonymousUsers'
    $ PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION='allowClientClassCreation'
    $ PARSE_SERVER_MOUNT_PATH='mountPath'
    $ PARSE_SERVER_DATABASE_ADAPTER='databaseAdapter'
    $ PARSE_SERVER_FILES_ADAPTER='filesAdapter'
    $ PARSE_SERVER_LOGGER_ADAPTER='loggerAdapter'
    $ PARSE_SERVER_MAX_UPLOAD_SIZE='maxUploadSize'

  Get Started guide:

    Please have a look at the get started guide!
    https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide


  Usage with npm start

    $ npm start -- path/to/config.json
    $ npm start -- --appId APP_ID --masterKey MASTER_KEY --serverURL serverURL
    $ npm start -- --appId APP_ID --masterKey MASTER_KEY --serverURL serverURL


  Usage:

    $ parse-server path/to/config.json
    $ parse-server -- --appId APP_ID --masterKey MASTER_KEY --serverURL serverURL
    $ parse-server -- --appId APP_ID --masterKey MASTER_KEY --serverURL serverURL


ERROR: appId and masterKey are required

I am referring to this statement in Readme file
"You may pass these as parameters when running a standalone parse-server, or by loading a configuration file in JSON format using parse-server path/to/configuration.json. "

@flovilmart
Copy link
Contributor

That's odd, did you set appId and masterKey in your json? Can you post your JSON?

@flovilmart
Copy link
Contributor

your config.json should look like that:

{
"appId": "hello",
"masterKey": "world"
}

@gowridev
Copy link
Author

gowridev commented Apr 5, 2016

Thank you ,its working now.(using variable names as appId,masterKey,..)

Sorry, I forgot to share the JSON the file. Can we give environment variables in the JSON file?
{
"PARSE_SERVER_APPLICATION_ID" : "9vEs0Z6di8uzmPsqr1I3678",
"PARSE_SERVER_MASTER_KEY" : "9O54LhBKV8oBg0th6Nhyzs",
"PARSE_SERVER_PARSE_MOUNT" : "/parse",
"PARSE_SERVER_REST_KEY" : "TAStOctHQNSeE4AS135Gdf",
"PARSE_SERVER_DATABASE_URI" : "mongodb://user3:password@localhost:27017/sampleone",
"PARSE_SERVER_CLIENT_KEY" : "ybUWZKQhv7Kb7nF2rk8efz"
}

@flovilmart
Copy link
Contributor

no, the JSON file uses the regular format with the same naming as the options when you use it as an express middleware

@tanzeelrana
Copy link

tanzeelrana commented Oct 15, 2016

my configuration.json is as follow

{
"appId": "appID",
"masterKey": "masterKey",
"databaseURI": "mongodb://localhost:27017/dev",
"port": 1338,
"serverURL": "http://localhost:1338/parse"
}

but I keep getting an error when I run

npm start configuration.js

/configuration.js:2
"appId": "hello",
^

SyntaxError: Unexpected token :
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at parseConfigFile (/root/HIMS_Test_Server/lib/cli/utils/commander.js:88:22)
at Command._commander.Command.parse (/root/HIMS_Test_Server/lib/cli/utils/commander.js:128:18)
at exports.default (/root/HIMS_Test_Server/lib/cli/utils/runner.js:22:23)

Can someone help please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants