square / connect-api-examples

Code samples demonstrating the functionality of the Square Connect API
https://developer.squareup.com/docs/sample-apps
393 stars 790 forks source link

Launch app without typing credentials in command line #253

Open gumtreecreek opened 3 years ago

gumtreecreek commented 3 years ago

Hi I notice warning info in readme file that the app can only be run when four environment variables entered in command line, is it allowed to preset four environment variables in code so that when users complete customisation of the code users can just integrate to their own project after that all they need to do is just launch the server to enable their own website running.

Another question is that I have completed coding my own ecommerce website and to be able to run the website all I need to do is just start the cloud server, the website would be running, my question is how my project would be running where square payment module need four environment variables to be able to launch but normally user's website project can run once the server launched ?

Hope someone can understand my question and help me, because normally environment variables suppose to allow user to write in the code, there will be no extra steps before run website program except start the server.

emmac3 commented 3 years ago

Hi @gumtreecreek,

If you are using the sample app under v2, they should have a .env.example file and instructions in the README to create a .env file where you can enter your credentials. The sample apps should then be able read the environment variables in the .env file.

If this does not solve your problem, please let me know which sample app you are using so that I can assist you further.

gumtreecreek commented 3 years ago

Hi @gumtreecreek,

If you are using the sample app under v2, they should have a .env.example file and instructions in the README to create a .env file where you can enter your credentials. The sample apps should then be able read the environment variables in the .env file.

If this does not solve your problem, please let me know which sample app you are using so that I can assist you further.

Hi, emmac3 thank you for your reply. I'm currently coding based on V2 java payment in IDEA using spring framework. I'm still getting a bit difficulty running program without entering 4 environment variables. I tried to put variables in YML or property file but it's failed as variables not entered before running.

What I'm trying to do is to complete the payment module and integrate to my own ecommerce website project and then upload the war of the whole project including integrated payment module to the server. but it would be impossible to do so by entering 4 variables beforehand to be able to launch the payment module. because normally once complete coding for users deploy website they only need to start the server. 4 environment variables should be preset in the code or in property file.

It would be much great if you could shed some light on this sort of issue.