Categories
Mastering Development System & Network

linux capabilities to read environment variables?

I’d like to run a service as a non-privileged user, but it needs to bind to a system port number (i.e. less than 1024), so I give it setcap ‘cap_net_bind_service=+ep’ <path for service>, all good. Problem is, on startup, the service reads environment vars and for some reason it can’t do that when it has […]

Categories
Linux Mastering Development

linux capabilities to read environment variables?

I’d like to run a service as a non-privileged user, but it needs to bind to a system port number (i.e. less than 1024), so I give it setcap ‘cap_net_bind_service=+ep’ <path for service>, all good. Problem is, on startup, the service reads environment vars and for some reason it can’t do that when it has […]

Categories
Mastering Development System & Network

linux capabilities to read environment variables?

I’d like to run a service as a non-privileged user, but it needs to bind to a system port number (i.e. less than 1024), so I give it setcap ‘cap_net_bind_service=+ep’ <path for service>, all good. Problem is, on startup, the service reads environment vars and for some reason it can’t do that when it has […]

Categories
Development Python

Is there a pythonic way to decouple optional functionality from a function’s main purpose?

Context Suppose I have the following Python code: def example_function(numbers, n_iters): sum_all = 0 for number in numbers: for _ in range(n_iters): number = halve(number) sum_all += number return sum_all ns = [1, 3, 12] print(example_function(ns, 3)) example_function here is simply going through each of the elements in the ns list and halving them 3 […]