Rework config file location

Implement IPFS_CONFIG_DIR and refactor code to make it simpler. Fix bug in `-c` option handling in `init` subcommand, and add `-c` support to `config` subcommand.

Also add `ipfs init` `-d` option to change default datastore location when initializing ipfs.
The private key will be encrypted later on. Fs permissions won't do much for us.

—
Sent from Mailbox

On Fri, Sep 26, 2014 at 1:30 PM, Jeromy Johnson <notifications@github.com>
wrote:

>>  	}
>>  	cfg.Datastore.Path = dspath
>>  	cfg.Datastore.Type = "leveldb"
>>  
>> +	// Construct the data store if missing
>> +	if err := os.MkdirAll(dspath, os.ModeDir); err != nil {
> 0555 is plenty, ipfs is read only. just make sure you binary OR it with os.ModeDir.
> As for making the private key a little more secure, i agree completely. If you want to throw that on this PR, that works for me.
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jbenet/go-ipfs/pull/126/files#r18111981