Answer the question
In order to leave comments, you need to log in
Rails how to work with config file?
Hello. I change have a simple ini file
Color=F0
PgServiceName=postgresql-x64-10
PGDATA=C:\Program Files\PostgreSQL\10\data\
PgBin=C:\Program Files\PostgreSQL\10\bin\
PGUSER=postgres
PGPASSWORD=1
Answer the question
In order to leave comments, you need to log in
It's simple. Read the file line by line, extracting the key=value on each line:
PATTERN = /(.+)=(.+)/
match_data = line.match(PATTERN)
p match_data[1]
p match_data[2]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question