Repository: Kinto/kinto

Issue:
Add creation date and current kinto version to generated config file
Using comments for example:

``` ini
# Created at Thu, 03 Mar 2016 17:02:37 +0100
# Using Kinto version 1.11.2

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 8888

```



Discussion:
Great idea!


Resolving patch:
diff --git a/kinto/config/__init__.py b/kinto/config/__init__.py
--- a/kinto/config/__init__.py
+++ b/kinto/config/__init__.py
@@ -1,9 +1,11 @@
 import os
 import codecs
+from time import strftime
 
 from cliquet import utils as cliquet_utils
 
 from kinto import logger
+from kinto import __version__
 
 HERE = os.path.abspath(os.path.dirname(__file__))
 
@@ -29,6 +31,9 @@ def init(config_file, backend):
 
     values['secret'] = cliquet_utils.random_bytes_hex(32)
 
+    values['kinto_version'] = __version__
+    values['config_file_timestamp'] = strftime('%a, %d %b %Y %H:%M:%S %z')
+
     values['storage_backend'] = "cliquet.storage.%s" % backend
     values['cache_backend'] = "cliquet.cache.%s" % backend
     values['permission_backend'] = "cliquet.permission.%s" % backend


Test patch:
diff --git a/kinto/tests/test_config.py b/kinto/tests/test_config.py
--- a/kinto/tests/test_config.py
+++ b/kinto/tests/test_config.py
@@ -3,10 +3,12 @@
 import os
 import tempfile
 import unittest
+from time import strftime
 
 import six
 
 from kinto import config
+from kinto import __version__
 
 
 class ConfigTest(unittest.TestCase):
@@ -21,7 +23,9 @@ def test_transpose_parameters_into_template(self):
                                permission_backend='permission_backend',
                                storage_url='storage_url',
                                cache_url='cache_url',
-                               permission_url='permission_url')
+                               permission_url='permission_url',
+                               kinto_version='kinto_version',
+                               config_file_timestamp='config_file_timestamp')
 
         with codecs.open(dest, 'r', encoding='utf-8') as d:
             destination_temp = d.read()
@@ -43,7 +47,9 @@ def test_create_destination_directory(self):
                                permission_backend='permission_backend',
                                storage_url='storage_url',
                                cache_url='cache_url',
-                               permission_url='permission_url')
+                               permission_url='permission_url',
+                               kinto_version='kinto_version',
+                               config_file_timestamp='config_file_timestamp')
 
         self.assertTrue(os.path.exists(dest))
 
@@ -68,7 +74,9 @@ def test_init_postgresql_values(self, mocked_render_template):
             'permission_backend': 'cliquet.permission.postgresql',
             'storage_url': postgresql_url,
             'cache_url':  postgresql_url,
-            'permission_url': postgresql_url
+            'permission_url': postgresql_url,
+            'kinto_version': __version__,
+            'config_file_timestamp': strftime('%a, %d %b %Y %H:%M:%S %z')
         })
 
     @mock.patch('kinto.config.render_template')
@@ -86,7 +94,9 @@ def test_init_redis_values(self, mocked_render_template):
             'permission_backend': 'cliquet.permission.redis',
             'storage_url': redis_url + '/1',
             'cache_url':  redis_url + '/2',
-            'permission_url': redis_url + '/3'
+            'permission_url': redis_url + '/3',
+            'kinto_version': __version__,
+            'config_file_timestamp': strftime('%a, %d %b %Y %H:%M:%S %z')
         })
 
     @mock.patch('kinto.config.render_template')
@@ -103,7 +113,9 @@ def test_init_memory_values(self, mocked_render_template):
             'permission_backend': 'cliquet.permission.memory',
             'storage_url': '',
             'cache_url':  '',
-            'permission_url': ''
+            'permission_url': '',
+            'kinto_version': __version__,
+            'config_file_timestamp': strftime('%a, %d %b %Y %H:%M:%S %z')
         })
 
     def test_render_template_creates_directory_if_necessary(self):
@@ -116,7 +128,9 @@ def test_render_template_creates_directory_if_necessary(self):
             'permission_backend': 'cliquet.permission.memory',
             'storage_url': '',
             'cache_url':  '',
-            'permission_url': ''
+            'permission_url': '',
+            'kinto_version': '',
+            'config_file_timestamp': ''
         })
         self.assertTrue(os.path.exists(destination))
 
@@ -130,7 +144,9 @@ def test_render_template_works_with_file_in_cwd(self):
             'permission_backend': 'cliquet.permission.memory',
             'storage_url': '',
             'cache_url':  '',
-            'permission_url': ''
+            'permission_url': '',
+            'kinto_version': '',
+            'config_file_timestamp': ''
         })
         self.assertTrue(os.path.exists(
             os.path.join(temp_path, 'kinto.ini')
diff --git a/kinto/tests/test_configuration/test.ini b/kinto/tests/test_configuration/test.ini
--- a/kinto/tests/test_configuration/test.ini
+++ b/kinto/tests/test_configuration/test.ini
@@ -1,3 +1,7 @@
+# Created at config_file_timestamp
+# Using Kinto version kinto_version
+
+
 [server:main]
 use = egg:waitress#main
 host = 0.0.0.0
@@ -142,4 +146,3 @@ formatter = generic
 
 [formatter_generic]
 format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
-