apigee / api-platform-samples

Working samples for the Apigee API Platform
Apache License 2.0
497 stars 713 forks source link

second try at userconf.sh change #78

Closed dfong closed 8 years ago

dfong commented 8 years ago

second try at userconf change.

this pull request adds a script setup/userconf.sh which is intended as a rough replacement for setup/setenv.sh . the current practice of storing credentials in setenv.sh is undesirable for 2 reasons:

it requires the user to make changes to be made in the git repo, where they show up in the "git status" listing.

since there is no easy way to tell whether changes have been made, every script must "ask" the user whether the configuration step has been done. this gets tedious for the user.

userconf.sh addresses these defects by:

storing the credentials in a file ~/.learn-edge.rc, external to the git repo.

the existence of the file tells us whether the configuration step has been done.

additional improvements:

prompting for variable values is more consistent and more user-friendly.

a new shell function get_password is provided, which gets the password and verifies it in one call.

added a new variable "edgetype" (value is either cloud or onprem). knowing the "edgetype" allows us to avoid prompting for variables which the user should leave at their default values (eg url and api_domain).

usage: scripts can just source in setup/userconf.sh instead of setup/setenv.sh and/or scripts/set_env.sh . also, after dotting in userconf.sh, call get_password instead of doing a read and calling scripts/verify_credentials.sh .