Watson Conversation_Error in Environment Variable

后端 未结 1 1584
时光取名叫无心
时光取名叫无心 2021-01-24 19:01

I am trying to copy Watson conversation simple node js application from GitHub (https://github.com/watson-developer-cloud/conversation-simple) and running in my local. I have cr

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-24 19:31

    Try to use the .env file and make sure the are no spaces between = and the end of the line.

    You need to have one file called .env, within the project from IBM Developers has one example, just delete the word: example, and the file will called just with .env in your Directory, like this image:

    And replace the values with your Service Credentials and your Workspace_id

    # Environment variables
    WORKSPACE_ID=490a9b3b-xxxxxxxxxxxxx
    CONVERSATION_USERNAME=xxxxxxxxxxxxxx-e1ebbc10
    CONVERSATION_PASSWORD=Bxxxx6FdzXxL
    

    Check another format:

    USERNAME="yourUsername"
    

    And in your app.js:

    var workspace = process.env.WORKSPACE_ID || '';
    console.log(process.env.WORKSPACE_ID);//your value will appear
    

    If you want, has another form, you can set the workspace_id and username, password in your app.js file.

    var username = 'usernameServiceCredentials'
    var password = 'passwordServiceCredentials'
    var workspace_id = 'workspaceFromConversation'
    
    • See the dotenv documentation for more information.
    • You can see your Credentials inside your Workspace -> Deploy -> Credentials

    0 讨论(0)
提交回复
热议问题