labrad / pylabrad

python interface for labrad
50 stars 31 forks source link

Environmental User and System Variables #350

Closed mserlin closed 6 years ago

mserlin commented 6 years ago

I have a remote labrad connection that, every time I form the connection, prompts me for a username and password. For local connections, I can define the user variable 'LOCALHOST' with value the local IP address, and the variable 'LABRADPASSWORD' with value 'pass' to automatically enter the password. How does one do this for remote connections?

Does a master list of variables that can be created and their purpose exist somewhere? I looked for a little and I couldn't' find much documentation about them.

Thanks! Marec

DanielSank commented 6 years ago

The LABRADPASSWORD, LABRADHOST, and LABRADPORT environment variables work whether you're connecting to your local machine or a remote one.

Does a master list of variables that can be created and their purpose exist somewhere?

I don't think so.

I looked for a little and I couldn't' find much documentation about them.

Please submit a pull request with a list :-)

mserlin commented 6 years ago

Hi Daniel,

Thank you for the response.

The LABRADPASSWORD, LABRADHOST, and LABRADPORT environment variables work whether you're connecting to your local machine or a remote one.

Is there a way to define these for multiple connections at once or to define a list of hosts for which it knows the default passwords? I have a computer that connects to servers running both locally and remotely. I can set the variables to accommodate either one connection or the other, but not both. I don't mind specifying the host of the connection when creating it, but ideally I'd avoid specifying the username / password each time.

Please submit a pull request with a list :-)

I'm not sure I understand. I can submit a request with the short list of variables that I know exist, but the point is that I don't know what's out there or how to find it! I am by no means a LABRAD expert.

Best, Marec

DanielSank commented 6 years ago

Is there a way to define these for multiple connections at once or to define a list of hosts for which it knows the default passwords?

You can write your own code to pull passwords from wherever you keep them. pylabrad doesn't have a built-in password manager or anything like that.

I have a computer that connects to servers running both locally and remotely.

Ok but you only ever need connection information when you connect to the manager, and you're probably not running more than one of those, are you?

mserlin commented 6 years ago

Ok but you only ever need connection information when you connect to the manager, and you're probably not running more than one of those, are you?

I might have been :-) Thank you for catching my fundamental mistake! Everything is fine now. Best, Marec

ejeffrey commented 6 years ago

To be clear, it is perfectly fine / possible to run multiple managers if you need to. But it is not the basic use case, that most people would start with.

What I typically do is write a small shell script or equivalent for each manager i use which sets all the environment variables and launches ipython.

On Wed, Dec 6, 2017 at 5:55 PM, mserlin notifications@github.com wrote:

Closed #350 https://github.com/labrad/pylabrad/issues/350.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/labrad/pylabrad/issues/350#event-1376052500, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnKHEjQ_-arxIDaGscAtwxmXeh_umX6ks5s90WHgaJpZM4Q4xSx .