Skip to content

Commit 7be2377

Browse files
authored
Merge pull request #25 from small-hack/fix-scripts-path
clean up create_user script and location of script
2 parents 173a999 + 5985169 commit 7be2377

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

charts/home-assistant/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.7.2
18+
version: 0.7.3
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Home Assistant versions can be found here:

charts/home-assistant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# home-assistant
22

3-
![Version: 0.7.2](https://img.shields.io/badge/Version-0.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2024.4.1](https://img.shields.io/badge/AppVersion-2024.4.1-informational?style=flat-square)
3+
![Version: 0.7.3](https://img.shields.io/badge/Version-0.7.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2024.4.1](https://img.shields.io/badge/AppVersion-2024.4.1-informational?style=flat-square)
44

55
A Helm chart for home assistant on Kubernetes
66

charts/home-assistant/config/create_user.py renamed to charts/home-assistant/scripts/create_user.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Author: https://github.com/jessebot
12
import json
23
from os import environ as env
34
import requests
@@ -6,6 +7,21 @@
67
class RunHomeAssistantOnboarding():
78
"""
89
Runs through home assistant onboarding to create a new user and disable registration
10+
Required environment variables:
11+
12+
INTERNAL_URL - if using k8s: name of k8s service, or if local you can use IP
13+
like this http://your-ip-here:8124
14+
EXTERNAL_URL - the url you use to access home assistant. if local, may be
15+
the same as INTERNAL_URL if using k8s with ingress, this is
16+
your ingress host, such as https://ha.yourhostname.tld/
17+
ADMIN_PASSWORD - string of password for initial owner user, not required, recommended
18+
default: "b33pB00p.d4Doop"
19+
20+
# optional environment variables
21+
DEBUG - print all api responses, WARNING includes sensitive data. set to "true"
22+
ADMIN_NAME - name of the first owner user, default: 'admin'
23+
ADMIN_USERNAME - login username of first owner user, default: 'admin'
24+
ADMIN_LANGUAGE - 2 character string of initial owner user's language, default "en"
925
1026
home assistant user onboarding urls found here:
1127
https://github.com/home-assistant/core/tree/dev/homeassistant/components/onboarding/views.py
@@ -14,7 +30,7 @@ def __init__(self):
1430
self.headers = {
1531
'Content-Type': 'application/json',
1632
}
17-
self.base_url = f"http://{env.get('SERVICE', 'home-assistant:8124')}"
33+
self.base_url = f"http://{env.get('INTERNAL_URL', 'localhost:8124')}"
1834
self.external_url = env.get('EXTERNAL_URL', '')
1935
self.debug = env.get('DEBUG', False)
2036

@@ -33,7 +49,7 @@ def run_integration_config(self) -> dict:
3349
"""
3450
runs the integration config step of onboarding via the home assistant api
3551
36-
may not be working 🤷
52+
may not be working 🤷, however this doesn't break the onboarding.
3753
"""
3854
integration_url = f"{self.base_url}/api/onboarding/integration"
3955
print(f"We're going to post to {integration_url} for integration config")
@@ -68,7 +84,7 @@ def create_user(self) -> dict:
6884
"client_id": client_id,
6985
"name": env.get('ADMIN_NAME', 'admin'),
7086
"username": env.get('ADMIN_USERNAME', 'admin'),
71-
"password": env.get('ADMIN_PASSWORD', 'test'),
87+
"password": env.get('ADMIN_PASSWORD', "b33pB00p.d4Doop"),
7288
"language": env.get('ADMIN_LANGUAGE', 'en')
7389
})
7490

charts/home-assistant/templates/create-user-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ metadata:
99
"helm.sh/hook-weight": "-5"
1010
data:
1111
create_user.py: |-
12-
{{ .Files.Get "config/create_user.py" | indent 4 }}
12+
{{ .Files.Get "scripts/create_user.py" | indent 4 }}
1313
{{- end }}

0 commit comments

Comments
 (0)