Code Monkey home page Code Monkey logo

ini-file's People

Contributors

bitnami-bot avatar carrodher avatar fmulero avatar gongomgra avatar javsalgar avatar jobachhu avatar marcosbc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ini-file's Issues

Adding a ";" (semi-colon) as part of the value breaks the tools output

Trying to create a PR for the postgresql pgbouncer image of yours for the auth_query value I ran into this issue...

doing a
ini-file --section "section" -- key "key" --value "test;" ./test.ini
will create file that looks like:

[section]
key=`test;`

it back-ticks the value, which seems to break some ini-parsers like the pgbouncer ini parser

I expected:

[section]
key=test;

The tool doesn't respect the original file permissions.

We found an issue with ini-file: it doesn’t respect the original permissions of a file. See this example:

$ touch file.ini
$ sudo chown bitnami:bitnami file.ini
$ sudo chmod 0664 file.ini
$ ls -la file.ini
-rw-rw--r-- 1 bitnami bitnami 0 May  4 09:15 file.ini
$ sudo ini-file set --section section --key foo --value bar file.ini
$ ls -la file.ini
-rw-r--r-- 1 root root 17 May  4 09:16 file.ini

The tool should respect whatever original permissions/ownership the file had.

Arrays are truncated when running ini-file

Hi,

I ran into this issue while trying to extend the bitnami-docker-matomo image and modifying the config file. It uses ini-file to set keys in matomo's config.ini.php file, which uses arrays to define installed and activated plugins. It took me a while to figure our why all but one plugin were deactivated after running through the configuration, it and seems like it was caused by setting unrelated config values using the ini-file utility.

Here is an example using a generic ini file and ini-file v1.4.1:

cat <<EOF > sample.ini
[third_section]
phpversion[] = "5.0"
phpversion[] = "5.1"
phpversion[] = "5.2"
phpversion[] = "5.3"

urls[svn] = "http://svn.php.net"
urls[git] = "http://git.php.net"
EOF

ini-file set -s "some_section" -k "some_key" -v "some_value" sample.ini

cat sample.ini

sample.ini now looks like this:

[third_section]
phpversion[]=5.3
urls[svn]=http://svn.php.net
urls[git]=http://git.php.net

[some_section]
some_key=some_value

Note that all but the last line of phpversion[] were removed. Any idea what might be causing this?

Thanks in advance!

returning array of section headers and section count

What is the problem this feature will solve?

given any "blackbox" .ini file, the tool will be able to return an array of all the section headers and a count of the number of sections

What is the feature you are proposing to solve the problem?

add capability to return:

  1. count of the number of sections in the .ini file
  2. array of the section headers for further iteration in bash

What alternatives have you considered?

none

The tool doesn't handle line comments

Hi!

When the input file has commented out attributes, the file gets messed up after using ini-file.

Input file:

[Global]
;proxy_client_headers[] = HTTP_X_FORWARDED_FOR

Command:

ini-file set --section "General" --key "proxy_client_headers[]" --value "HTTP_X_FORWARDED_FOR" /path/to/file

Expected result (either this):

[Global]
proxy_client_headers[] = HTTP_X_FORWARDED_FOR

Expected result (or something like this):

[Global]
;proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_client_headers[] = HTTP_X_FORWARDED_FOR

Actual result:

; ;proxy_client_headers[] = HTTP_X_FORWARDED_FOR

Background info and use case

I came in contact with this tool in my efforts to create a custom image based on bitnami/matomo and found a potential bug/feature request.

I wanted to do this:

I needed to create a custom image based on bitnami/matomo with a custom Matomo configuration, since the configuration changes I desire cannot be configured using evironment variables (which are parsed by libmatomo.sh).

This is how I did it:

Use the ini-file tool to manipulate global.ini.php while building a custom image based on bitnami/matomo.

Dockerfile:

FROM bitnami/matomo:4-debian-10 AS build-env
USER 0
RUN ini-file set --section "General" --key "proxy_client_headers[]" --value "HTTP_X_FORWARDED_FOR" /opt/bitnami/matomo/config/global.ini.php
USER 1001
EXPOSE 8080 8443

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.