Re: is there a property for this?
Re: is there a property for this?
- Subject: Re: is there a property for this?
- From: Paul Hoadley <email@hidden>
- Date: Mon, 01 Apr 2013 17:41:11 +1030
On 01/04/2013, at 2:01 PM, Theodore Petrosky <email@hidden> wrote:
> is there a way to populate my username and password field through a property?
>
> normally, I would use the setter:
>
>
> // this.setUsername("sysadmin");
> // this.setPassword("4004");
>
>
> in the Main constructor and comment it out when I compile for deploy. I thought that setting it in a developer property file would be neat and tidy.
I won't touch on the meta-issue of whether or not this is a good idea—to answer your question: Sure, you can make properties for whatever you like. In Properties.ted (substitute your actual username on your development machine for 'ted'):
com.example.YourApp.devMode.username=sysadmin
com.example.YourApp.devMode.password=4004
(The keys there are entirely arbitrary. You could just use 'username' and 'password' if you want.) Then, wherever you like in your app:
private static final String USERNAME_KEY = "com.example.YourApp.devMode.username";
private static final String PASSWORD_KEY = "com.example.YourApp.devMode.password";
...
if (ERXApplication.isDevelopmentMode()) {
this.setUsername(ERXProperties.stringForKey(USERNAME_KEY));
this.setPassword(ERXProperties.stringForKey(PASSWORD_KEY));
}
--
Paul Hoadley
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden