Configuration
App::TimeTracker uses a bunch of config files in JSON format. The config files valid for a specific instance of tracker
are collected by walking the directory tree up from the current working directory, and merging all .tracker.json
files that are found, plus the main config file ~/.TimeTracker/tracker.json
.
You can use this tree of config files to define general settings, per job settings and per project settings, while always reusing the configuration defined in the parent. I.e. the config settings sort of override the values defined further up in the tree.
Anytime you call tracker
, we look up from your current directory until we find the first .tracker.json
file. This file marks the current project.
See App::TimeTracker::Command::Core and the various plugins for valid config parameters.
The different config files
Main config file: ~/.TimeTracker/tracker.json
The main config file lives in a directory named .TimeTracker
located in your home directory (as defined by File::HomeDir). All other config files inherit from this file. You can, for example, use this file to define plugins you always want to use
List of projects: ~/.TimeTracker/projects.json
This file lists all the projects App::TimeTracker knows of on this machine. The content is autogenerated, so please do not edit it by hand. We use this file to locate all your working directories for the various reporing commands.
Per project config file: your-project/.tracker.json
Besides being the last node in the tree of the currently valid configuration, this file also defines the containing directory as a project.
Example
Given this directory structure:
~/.TimeTracker/tracker.json
~/job/.tracker.json
~/job/project/.tracker.json
If you hit start
in ~/job/project/
, all three of those config files will be merged and the resulting hash will be used as the current configuration.
If you hit start
in ~/job/
, only ~/job/.tracker.json
and ~/.TimeTracker/tracker.json
will be used.
This allows you to have global default settings, different default setting for different jobs, and fine tuned settings for each project. Of course you can have as many levels of configs as you want.
Tip:
Use tracker show_config
to dump the current configuration.
Using a different tree
Sometime you do not want to arrange your projects in the hierarchical way expected by App::TimeTracker:
~/perl/App-TimeTracker/.tracker.json
~/perl/App-TimeTracker-Gtk2TrayIcon/.tracker.json
Both App-TimeTracker
and App-TimeTracker-Gtk2TrayIcon
live in the same directory and thus would be considered seperate projects. But I want App-TimeTracker-Gtk2TrayIcon
to be a sub-project of App-TimeTracker
, without having to change the directory structure.
The solution: parent
In any config file you can define a key called parent
. If this key is defined, the config-walker will use that project as the parent, and ignore the directory structure:
~/perl/App-TimeTracker-Gtk2TrayIcon$ cat .tracker.json
{
"project":"App-TimeTracker-Gtk2TrayIcon",
"parent":"App-TimeTracker"
}
And here's the relevant output of tracker show_config
:
'_used_config_files' => [
'/home/domm/perl/App-TimeTracker-Gtk2TrayIcon/.tracker.json',
'/home/domm/perl/App-TimeTracker/.tracker.json',
'/home/domm/perl/.tracker.json',
'/home/domm/.TimeTracker/tracker.json'
],
So what do you think?