Skip to content

Commit

Permalink
Changed pooly to look for an environment variable to tell it where the
Browse files Browse the repository at this point in the history
pooly.conf file is located.  It was looking for it in its own priv
directory which did not allow it to be portable between applications.
  • Loading branch information
aberman committed Nov 23, 2011
1 parent f160c4c commit 8928efb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@

### Recent changes

#### 11/23/2011
* Changed application to look for an environment variable to tell it where the pooly.conf file is located. This should improve portability when included in other applications.

#### 8/14/2011
* Added support for multiple pools
* Added support for default configuration parameters but allow a pool to override a parameter
* Added support for generic OTP compliant pools
* Added support for generic OTP compliant pools

## Quick Start

1. Create a pooly.conf configuration file in the priv directory
2. Configure one or more pools in the configuration file
3. Start up erlang
3. Create an app config file for your application which includes:
```
[{pooly, [{config_file, LocationOfFile}]}].
e.g. [{pooly, [{config_file, "priv/pooly.conf"}]}].
This will allow pooly to use your application's priv directory as opposed to its own.
```

4. Start up erlang using the -config directive passing it the name of your config file. For example, if your application config file is named, myApp.config, you would type: erl -config myApp

```
> application:start(pooly).
Expand Down Expand Up @@ -44,7 +55,7 @@ Until I document the code, please refer here on how to use Pooly.

#### Check out a process from the pool:
```
pooly:check_out(PoolName)
pooly:check_out(PoolName)
-> {ok, Pid}
-> {error, pool_exhausted} - The pool has reached maximum capacity as determined by the max_pool_size
```
Expand Down Expand Up @@ -73,11 +84,11 @@ pooly:total_count(PoolName) -> {ok, integer()}

Copyright ©2011 Andrew Berman

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions priv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/pooly.conf
8 changes: 5 additions & 3 deletions src/pooly_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
%% Application callbacks
%% ===================================================================
start(_StartType, _StartArgs) ->
{ok, Conf} = file:consult(filename:join(
[filename:dirname(code:which(?MODULE)),
"..", "priv", "pooly.conf"])),
ConfigFile = case application:get_env(config_file) of
undefined -> exit({config_not_set, "Set the config_file application parameter"});
{ok, Val} -> Val
end,
{ok, Conf} = file:consult(ConfigFile),
PoolProps = lists:filter(fun({Key, _}) -> not lists:member(Key, ?CONFIG_KEYS) end, Conf),
% Get Any Default Settings
DefaultConfig = #config{
Expand Down

0 comments on commit 8928efb

Please sign in to comment.