Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-api into OH2-400_responseentity_refactoring
  • Loading branch information
SilverD3 committed Oct 30, 2024
2 parents 0a11c27 + e7da5dd commit 305ce36
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 352 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,27 @@ jobs:
- name: Determine PR source branch and fork repository
id: vars
run: |
# Set BRANCH_NAME based on event type
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
fi
# Set default FORK_REPO and BRANCH_NAME values.
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}"
FORK_REPO="${GITHUB_HEAD_REPOSITORY:-${GITHUB_ACTOR}/openhospital-core}"
CHECK_BRANCH_URL="https://github.com/${GITHUB_ACTOR}/openhospital-core/tree/$BRANCH_NAME"
echo "Checking branch existence with: curl -s -o /dev/null -w \"%{http_code}\" $CHECK_BRANCH_URL"
# Determine FORK_REPO with fallback logic
if [[ -n "${GITHUB_HEAD_REPOSITORY}" ]]; then
echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY}" >> $GITHUB_ENV
elif curl -s --head https://github.com/${GITHUB_ACTOR}/openhospital-core | grep "200 OK" > /dev/null; then
echo "FORK_REPO=${GITHUB_ACTOR}/openhospital-core" >> $GITHUB_ENV
echo "Using ${GITHUB_HEAD_REPOSITORY}."
FORK_REPO=${GITHUB_HEAD_REPOSITORY}
elif curl -s -o /dev/null -w "%{http_code}" $CHECK_BRANCH_URL | grep -q "200"; then
echo "Using ${GITHUB_ACTOR}/openhospital-core"
FORK_REPO=${GITHUB_ACTOR}/openhospital-core
else
echo "FORK_REPO=informatici/openhospital-core" >> $GITHUB_ENV
echo "Using informatici/openhospital-core."
FORK_REPO="informatici/openhospital-core"
fi
# Export FORK_REPO and BRANCH_NAME to GITHUB_ENV for the next step
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "FORK_REPO=$FORK_REPO" >> $GITHUB_ENV
- name: Log variables
run: |
Expand Down Expand Up @@ -69,4 +75,4 @@ jobs:
popd
- name: Build with Maven
run: mvn install -DskipTests=true
run: mvn install
36 changes: 20 additions & 16 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,27 @@ jobs:
- name: Determine PR source branch and fork repository
id: vars
run: |
# Get branch name from either pull_request or push context
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
# Get branch and fork repo for PR events
echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
# Get branch name for push events
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
# Default FORK_REPO to main repository, with option to fallback if the fork exists
OWNER=${GITHUB_ACTOR}
if curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/${OWNER}/openhospital-core/branches/${GITHUB_REF##*/}" | grep -q "200"; then
echo "FORK_REPO=${OWNER}/openhospital-core" >> $GITHUB_ENV
else
echo "FORK_REPO=informatici/openhospital-core" >> $GITHUB_ENV
fi
# Set default FORK_REPO and BRANCH_NAME values.
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}"
FORK_REPO="${GITHUB_HEAD_REPOSITORY:-${GITHUB_ACTOR}/openhospital-core}"
CHECK_BRANCH_URL="https://github.com/${GITHUB_ACTOR}/openhospital-core/tree/$BRANCH_NAME"
echo "Checking branch existence with: curl -s -o /dev/null -w \"%{http_code}\" $CHECK_BRANCH_URL"
# Determine FORK_REPO with fallback logic
if [[ -n "${GITHUB_HEAD_REPOSITORY}" ]]; then
echo "Using ${GITHUB_HEAD_REPOSITORY}."
FORK_REPO=${GITHUB_HEAD_REPOSITORY}
elif curl -s -o /dev/null -w "%{http_code}" $CHECK_BRANCH_URL | grep -q "200"; then
echo "Using ${GITHUB_ACTOR}/openhospital-core"
FORK_REPO=${GITHUB_ACTOR}/openhospital-core
else
echo "Using informatici/openhospital-core."
FORK_REPO="informatici/openhospital-core"
fi
# Export FORK_REPO and BRANCH_NAME to GITHUB_ENV for the next step
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "FORK_REPO=$FORK_REPO" >> $GITHUB_ENV
- name: Log variables
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
Expand Down Expand Up @@ -200,6 +200,7 @@
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
Expand Down Expand Up @@ -280,6 +281,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
Expand Down Expand Up @@ -310,6 +312,7 @@
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
Expand Down
3 changes: 3 additions & 0 deletions rsc/application.properties.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ server.servlet.session.cookie.http-only=true
spring.pid.fail-on-write-error=true
spring.pid.file=OH_API_PID

### In production change to http://<domain>
cors.allowed.origins=http://API_HOST:API_PORT,http://UI_HOST:UI_PORT

### Swagger-UI (info)
api.host=API_HOST:API_PORT
api.protocol=http
Expand Down
Loading

0 comments on commit 305ce36

Please sign in to comment.