configuration-files

Automatically load a config.php file for all pages before anything else

落花浮王杯 提交于 2019-11-30 00:49:14
问题 Does anyone know how to set up something where a specific file can be loaded automatically for all pages before anything else? For example if I have a config.php file and I want this file to be loaded anytime anyone visits a page on my website. In here I would have some configuration info that is required to load prior to anything else. I don't want to do any includes on another php file for this I just want this to be loaded every time automatically before anything else. Basically a

Ruby loading config (yaml) file in same dir as source

独自空忆成欢 提交于 2019-11-29 22:52:17
in HOME/path_test/ I have: load_test.rb: require 'yaml' cnf = YAML::load(File.open('config.yml')) puts cnf['Hello'] config.yml: Hello: world!!! when in HOME/path_test/ I get as expected: -bash-3.2$ ruby load_test.rb world!!! when in HOME/ (cd ..) I get -bash-3.2$ ruby path_test/load_test.rb path_test/load_test.rb:3:in `initialize': No such file or directory - config.yml (Errno::ENOENT) from path_test/load_test.rb:3:in `open' from path_test/load_test.rb:3:in `<main>' Which is correct behavior, but not what I had wished for :) Is there a way to load the .yml file relative to the source file, and

Where do I put my XML beans in a Spring Boot application?

大兔子大兔子 提交于 2019-11-29 22:19:25
I'm getting back into Spring (currently v4). It's all wonderful now with @SpringBootApplication and the other annotations but all the documentation seems to forget to mention how I define other beans in XML! For example I'd like to create an "SFTP Session Factory" as defined at: http://docs.spring.io/spring-integration/reference/html/sftp.html There is a nice bit of XML to define the bean but where on earth do I put it and how do I link it in? Previously I did a: ApplicationContext context = new ClassPathXmlApplicationContext( "classpath:applicationContext.xml"); to specify the file name and

how to have custom attribute in ConfigurationElementCollection?

谁都会走 提交于 2019-11-29 20:59:26
for configuration as following <MyCollection default="one"> <entry name="one" ... other attrubutes /> ... other entries </MyCollection> when implement a MyCollection, what should i do for the "default" attribute? Let's suppose you have this .config file: <configuration> <configSections> <section name="mySection" type="ConsoleApplication1.MySection, ConsoleApplication1" /> // update type & assembly names accordingly </configSections> <mySection> <MyCollection default="one"> <entry name="one" /> <entry name="two" /> </MyCollection> </mySection> </configuration> Then, with this code: public class

Which is the best way to allow configuration options be overridden at the command line in Python?

一世执手 提交于 2019-11-29 19:19:25
I have a Python application which needs quite a few (~30) configuration parameters. Up to now, I used the OptionParser class to define default values in the app itself, with the possibility to change individual parameters at the command line when invoking the application. Now I would like to use 'proper' configuration files, for example from the ConfigParser class. At the same time, users should still be able to change individual parameters at the command line. I was wondering if there is any way to combine the two steps, e.g. use optparse (or the newer argparse) to handle command line options

How to locate the vimrc file used by vim editor?

不羁岁月 提交于 2019-11-29 18:55:43
Is there a command in the vim editor to find the .vimrc file location? manojlds Just try doing the following: :version You will get an output which includes something like: system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" system menu file: "$VIMRUNTIME/menu.vim" As noted by Herbert in comments, this is where vim looks for vimrc s, it doesn't mean they exist. You can check the full path of your vimrc with :echo $MYVIMRC If the output is empty, then your vim doesn't use a user vimrc

How do I globally configure RSpec to keep the '--color' and '--format specdoc' options turned on

夙愿已清 提交于 2019-11-29 18:49:10
How do I set global configuration for RSpec in Ubuntu. Specifically so, --color and --format specdoc stay turned on, across all my projects (ie every time I run rspec anywhere). abyx As you can see in the docs here , the intended use is creating ~/.rspec and in it putting your options, such as --color . To quickly create an ~/.rspec file with the --color option, just run: echo '--color' >> ~/.rspec One can also use a spec_helper.rb file in all projects. The file should include the following: RSpec.configure do |config| # Use color in STDOUT config.color = true # Use color not only in STDOUT

my_config.ini vs my_config.php

不羁岁月 提交于 2019-11-29 16:59:15
问题 At work we use a .ini file to set variables prior to calling the rest of the framework (I think it goes function getConfigVars(){ //read my_config.ini file .... //call framework } and I have always wondered if there was a benefit to doing it that way. It seems to me that you then have to write access rules to stop people from looking at it from the web and php has to parse it and understand it. So, why use my_config.ini rather than my_config.php? It is not like anyone should be touching it

Why does Visual Studio tell me that the AddJsonFile() method is not defined?

夙愿已清 提交于 2019-11-29 16:33:49
问题 I'm developing an ASP.NET 5 WebAPI project using VS Ultimate 2015 Preview. I'm trying to configure the app in this way (line numbers are just guides): 1 using Microsoft.Framework.ConfigurationModel; 2 3 public IConfiguration Configuration { get; private set; } 4 5 public Startup() 6 { 7 Configuration = new Configuration() 8 .AddJsonFile("config.json") 9 .AddEnvironmentVariables(); 10 } Line 8 gives me an error: 'Configuration' does not contain a definition for 'AddJsonFile'... What is wrong?

Nginx Yii2 configuration in different folders

末鹿安然 提交于 2019-11-29 15:44:06
I faced with problem in configuring nginx server for yii2 basic app. Here is my service block file : server { listen 80 ; access_log /var/log/nginx/access-server.log; error_log /var/log/nginx/error-server.log; charset utf-8; location /fetch { root /usr/share/nginx/html/another_folder/web/; try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } My project located in another folder "another