1#!/usr/bin/env python
2#
3# A script similar to GNU envsubst, but filters out
4# some CI related variables.
5
6import os
7import sys
8
9
10def main():
11    # Sanitize environment variables
12    vars_to_remove = []
13    for var_name in os.environ.keys():
14        if var_name.startswith('CI_'):
15            vars_to_remove.append(var_name)
16    for var_name in vars_to_remove:
17        del os.environ[var_name]
18
19    for line in sys.stdin:
20        if not line:
21            break
22        sys.stdout.write(os.path.expandvars(line))
23    sys.stdout.flush()
24
25
26if __name__ == '__main__':
27    main()
28